From d48fa5065401ae63d6a2a32e38d3c576bba164d1 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 30 Nov 2015 17:11:57 -0800 Subject: [PATCH] feat(rsvp): "Quick RSVP" to events recongized by the API --- .../lib/preferences-signatures.cjsx | 2 +- .../events/lib/event-component.cjsx | 107 -------------- .../events/lib/event-header.cjsx | 93 ++++++++++++ internal_packages/events/lib/main.cjsx | 10 +- .../events/stylesheets/events.less | 4 +- .../lib/autoload-images-header.cjsx | 4 + .../message-list/lib/message-item.cjsx | 18 --- .../preferences/lib/preferences-sidebar.cjsx | 4 +- .../lib/tabs/config-schema-item.cjsx | 3 +- spec/utils-spec.coffee | 137 +----------------- src/flux/models/utils.coffee | 7 - src/global/nylas-exports.coffee | 2 +- 12 files changed, 112 insertions(+), 279 deletions(-) delete mode 100644 internal_packages/events/lib/event-component.cjsx create mode 100644 internal_packages/events/lib/event-header.cjsx diff --git a/internal_packages/composer-signature/lib/preferences-signatures.cjsx b/internal_packages/composer-signature/lib/preferences-signatures.cjsx index 76b81a140..14b477f9d 100644 --- a/internal_packages/composer-signature/lib/preferences-signatures.cjsx +++ b/internal_packages/composer-signature/lib/preferences-signatures.cjsx @@ -59,7 +59,7 @@ class PreferencesSignatures extends React.Component _renderAccountPicker: -> options = @state.accounts.map (account) -> - + {_.zip(@props.configSchema.enum, @props.configSchema.enumLabels).map ([value, label]) => - + } diff --git a/spec/utils-spec.coffee b/spec/utils-spec.coffee index 300ae6918..2298cf535 100644 --- a/spec/utils-spec.coffee +++ b/spec/utils-spec.coffee @@ -22,7 +22,7 @@ describe "modelFreeze", -> b: 2 Utils.modelFreeze(o) expect(Object.isFrozen(o)).toBe(true) - + it "should not throw an exception when nulls appear in strange places", -> t = new Thread(participants: [new Contact(email: 'ben@nylas.com'), null], subject: '123') Utils.modelFreeze(t) @@ -348,141 +348,6 @@ describe "isEqual", -> other = {a: 1} ok(!Utils.isEqual(new Foo, other)) -describe "looksLikeGmailInvite", -> - it "should return false for an exchange invite", -> - message = { - body: """ - - - - -
- - - - - - - - - -
- -
- - - - -

- (No Subject)

- - - - - - - - - - - - - - - -
-
When
-
- Thu Jul 30, 2015 10pm – 11pm - GMT (no daylight saving)
-
Calendar
-
- ethan@nylas.com
-
Who
-
- - - - - - - - - - - -
- -
-
Ethan Blackburn - - - organizer
-
-
- -
-
ethan@nylas.com - -
-
-
-
-
-

Going? - - - - - - - - - - - -

-
-

Invitation from - Google Calendar

-

You are receiving this email at the account ethan@nylas.com because you are subscribed for invitations on calendar ethan@nylas.com.

-

To stop receiving these emails, please log in to https://www.google.com/calendar/ and change your notification settings for this calendar.

-

Forwarding this invitation could allow any recipient to modify your RSVP response. - Learn More.

-
-
- - """ - } - - expect(Utils.looksLikeGmailInvite(message)).toEqual(true) - - it "should return true for a gmail invite", -> - message = { - body: """ - - - - -
-
-
- Begin forwarded message:
-
- From: Originator <originator@nylas.com>
- Subject: <> Nylas E-mail Call and Webhooks review
- Date: Jul 28 2015, at 2:32 pm
- To: random@guy.com <random@guy.com>, Someone Else <someone@else.com> -
-
- -
- Call to review Pipeline Deals email tool and webhooks support.
-
- - """ - } - describe "subjectWithPrefix", -> it "should replace an existing Re:", -> expect(Utils.subjectWithPrefix("Re: Test Case", "Fwd:")).toEqual("Fwd: Test Case") diff --git a/src/flux/models/utils.coffee b/src/flux/models/utils.coffee index c650e355d..a4a983edc 100644 --- a/src/flux/models/utils.coffee +++ b/src/flux/models/utils.coffee @@ -99,13 +99,6 @@ Utils = return ext in extensions and size > 512 and size < 1024*1024*5 - looksLikeGmailInvite: (message={}) -> - idx = message.body.search('itemtype="http://schema.org/Event"') - if idx == -1 - return false - return true - - # Escapes potentially dangerous html characters # This code is lifted from Angular.js # See their specs here: diff --git a/src/global/nylas-exports.coffee b/src/global/nylas-exports.coffee index 01a9fa6e8..be454f01c 100644 --- a/src/global/nylas-exports.coffee +++ b/src/global/nylas-exports.coffee @@ -88,7 +88,7 @@ class NylasExports # Tasks # These need to be required immediately to populate the TaskRegistry so # we know how to deserialized saved or IPC-sent tasks. - @require "EventRSVP", 'flux/tasks/event-rsvp' + @require "EventRSVPTask", 'flux/tasks/event-rsvp' @require "SendDraftTask", 'flux/tasks/send-draft' @require "FileUploadTask", 'flux/tasks/file-upload-task' @require "DestroyDraftTask", 'flux/tasks/destroy-draft'