From 01652ffb24e08c7977fa228c9b1a50471ec40a8c Mon Sep 17 00:00:00 2001 From: Eben Freeman Date: Sat, 3 Oct 2015 22:05:20 -0700 Subject: [PATCH] feat(feedback): intercom for feedback Summary: Caveat: If you submit feedback from one account, and then switch accounts and submit feedback again, the data from the old account still gets passed. It looks like that was true with the previous compose-a-draft-with-feedback action too. Maybe you know how to fix this? I couldn't figure it out. Test Plan: Try it out! Not sure how to usefully write specs. Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2106 --- .../worker-ui/lib/developer-bar-store.coffee | 55 ++++++---------- .../worker-ui/static/feedback.html | 62 +++++++++++++++++++ 2 files changed, 82 insertions(+), 35 deletions(-) create mode 100644 internal_packages/worker-ui/static/feedback.html diff --git a/internal_packages/worker-ui/lib/developer-bar-store.coffee b/internal_packages/worker-ui/lib/developer-bar-store.coffee index 840185b56..08ecb06b0 100644 --- a/internal_packages/worker-ui/lib/developer-bar-store.coffee +++ b/internal_packages/worker-ui/lib/developer-bar-store.coffee @@ -111,42 +111,27 @@ class DeveloperBarStore extends NylasStore @triggerThrottled(@) _onSendFeedback: -> - {AccountStore, - Contact, - Message, - DatabaseStore} = require 'nylas-exports' + {AccountStore} = require 'nylas-exports' + BrowserWindow = require('remote').require('browser-window') + path = require 'path' - user = AccountStore.current().name + account = AccountStore.current() + params = qs.stringify({ + name: account.name + email: account.emailAddress + accountId: account.id + platform: process.platform + provider: account.displayProvider() + organizational_unit: account.organizationUnit + version: atom.getVersion() + }) + w = new BrowserWindow + 'node-integration': false, + 'web-preferences': {'web-security':false}, + 'width': 450, + 'height': 700 - draft = new Message - from: [AccountStore.current().me()] - to: [ - new Contact - name: "Nylas Team" - email: "feedback@nylas.com" - ] - date: (new Date) - draft: true - subject: "Feedback" - accountId: AccountStore.current().id - body: """ - Hi, Nylas team! I have some feedback for you.
-
- What happened:
-
-
- Impact:
-
-
- Feedback:
-
-
- Environment:
- I'm using N1 #{atom.getVersion()} and my platform is #{process.platform}-#{process.arch}.
- --
- #{user}
- """ - DatabaseStore.persistModel(draft).then -> - Actions.composePopoutDraft(draft.clientId) + url = path.join __dirname, '../static/feedback.html' + w.loadUrl "file://#{url}?#{params}" module.exports = new DeveloperBarStore() diff --git a/internal_packages/worker-ui/static/feedback.html b/internal_packages/worker-ui/static/feedback.html new file mode 100644 index 000000000..e26a777ac --- /dev/null +++ b/internal_packages/worker-ui/static/feedback.html @@ -0,0 +1,62 @@ + + + + Feedback + + +