Mailspring/examples/N1-Quick-Schedule/lib/availability-composer-extension.cjsx
Drew Regitsky 4a2d0a64f6 fix(quickschedule): Several UI fixes
Summary:
Fixes a number of smaller UI issues. Fixes T6173, T6207
Full list of changes:
 - Ensure time slots / days display in order
 - Allow time blocks of any size to be set on half hour intervals
 - Don't reset calendar when changing event length
 - Expand calendar on window resize
 - Change window title from "Electron"
 - Add delete button to cancel individual calendar events
 - Move event details box to the left side
 - Prevent addition of duplicate time slots

Test Plan: manual

Reviewers: bengotow

Reviewed By: bengotow

Maniphest Tasks: T6173, T6207

Differential Revision: https://phab.nylas.com/D2333
2015-12-09 16:41:30 -08:00

25 lines
1 KiB
CoffeeScript

{ComposerExtension} = require 'nylas-exports'
request = require 'request'
class AvailabilityComposerExtension extends ComposerExtension
# When subclassing the ComposerExtension, you can add your own custom logic
# to execute before a draft is sent in the @finalizeSessionBeforeSending
# method. Here, we're registering the events before we send the draft.
@finalizeSessionBeforeSending: (session) ->
body = session.draft().body
participants = session.draft().participants()
sender = session.draft().from
matches = (/data-quick-schedule="(.*)?" style/).exec body
if matches?
json = atob(matches[1])
data = JSON.parse(json)
data.attendees = []
data.attendees = participants.map (p) ->
name: p.name, email: p.email, isSender: p.isMe()
serverUrl = "https://quickschedule.herokuapp.com/register-events"
request.post {url: serverUrl, body: JSON.stringify(data)}, (error, resp, data) =>
console.log(error,resp,data)
module.exports = AvailabilityComposerExtension