From b880ee981dd8f41f200ba948e4d042b17c701111 Mon Sep 17 00:00:00 2001 From: Karim Hamidou Date: Wed, 11 Jan 2017 14:29:50 -0800 Subject: [PATCH] [feat] [autoupdater] Introduce a new channel, "Nylas Mail" + let N1 specify a preferred channel. --- .../preferences/lib/tabs/update-channel-section.jsx | 12 +++++++++++- src/flux/stores/update-channel-store.es6 | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/internal_packages/preferences/lib/tabs/update-channel-section.jsx b/internal_packages/preferences/lib/tabs/update-channel-section.jsx index 6e23a6953..a48afd9b1 100644 --- a/internal_packages/preferences/lib/tabs/update-channel-section.jsx +++ b/internal_packages/preferences/lib/tabs/update-channel-section.jsx @@ -40,10 +40,17 @@ class UpdateChannelSection extends React.Component { // HACK: Temporarily do not allow users to move on to the Salesforce channel. // In the future we could implement this server-side via a "public" flag. - const allowedNames = ["stable", "beta"] + const allowedNames = ["nylas-mail", "beta"] if (NylasEnv.config.get("salesforce")) { allowedNames.push("salesforce"); } + + // Also a HACK: show the stable channel only for people who are on the stable + // channel. + if (current.name === "stable") { + allowedNames.push("stable"); + } + const allowed = available.filter(c => { return allowedNames.includes(c.name) || c.name === current.name }); @@ -51,7 +58,10 @@ class UpdateChannelSection extends React.Component { const displayNameForChannel = (channel) => { if (channel.name === 'beta') { return 'Beta (Unstable)' + } else if (channel.name === 'nylas-mail') { + return 'Nylas Mail (Stable)' } + return channel.name[0].toUpperCase() + channel.name.substr(1) } diff --git a/src/flux/stores/update-channel-store.es6 b/src/flux/stores/update-channel-store.es6 index cb8226578..342df9ca4 100644 --- a/src/flux/stores/update-channel-store.es6 +++ b/src/flux/stores/update-channel-store.es6 @@ -4,6 +4,7 @@ import {remote} from 'electron'; import {LegacyEdgehillAPI} from 'nylas-exports'; const autoUpdater = remote.getGlobal('application').autoUpdateManager; +const preferredChannel = 'nylas-mail'; class UpdateChannelStore extends NylasStore { constructor() { @@ -32,7 +33,7 @@ class UpdateChannelStore extends NylasStore { LegacyEdgehillAPI.makeRequest({ method: 'GET', path: `/update-channel`, - qs: autoUpdater.parameters(), + qs: Object.assign({preferredChannel: preferredChannel}, autoUpdater.parameters()), json: true, }).then(({current, available} = {}) => { this._current = current || {name: "Edgehill API Not Available"}; @@ -46,7 +47,8 @@ class UpdateChannelStore extends NylasStore { LegacyEdgehillAPI.makeRequest({ method: 'POST', path: `/update-channel`, - qs: Object.assign({channel: channelName}, autoUpdater.parameters()), + qs: Object.assign({channel: channelName, + preferredChannel: preferredChannel}, autoUpdater.parameters()), json: true, }).then(({current, available} = {}) => { this._current = current || {name: "Edgehill API Not Available"};