From ab3da1891f05872dd5bfd03df4bec5abbec0298a Mon Sep 17 00:00:00 2001 From: dillon Date: Tue, 22 Sep 2015 14:05:26 -0700 Subject: [PATCH] fix(activity-sidebar): render correct copy on only correct moments Summary: fixes T3725 changes: - show the sync mail activity only if number of deltas received is greater than 10 - make the sync mail activity notification persist for longer, since large deltas (>1k) come in intervals of about 25 seconds, which was greater than our previous timeout interval of 15 seconds - change to clearer copy - minor style changes to match new copy Test Plan: tested manually Reviewers: bengotow Maniphest Tasks: T3725 Differential Revision: https://phab.nylas.com/D2051 --- .../lib/activity-sidebar-long-poll-store.coffee | 2 +- .../notifications/lib/activity-sidebar.cjsx | 13 ++++++++----- .../worker-sync/lib/nylas-sync-worker-pool.coffee | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/internal_packages/notifications/lib/activity-sidebar-long-poll-store.coffee b/internal_packages/notifications/lib/activity-sidebar-long-poll-store.coffee index 211f36231..034d19871 100644 --- a/internal_packages/notifications/lib/activity-sidebar-long-poll-store.coffee +++ b/internal_packages/notifications/lib/activity-sidebar-long-poll-store.coffee @@ -3,6 +3,6 @@ NylasStore = require 'nylas-store' class AccountSidebarLongPollStore extends NylasStore constructor: -> - @listenTo Actions.longPollReceivedRawDeltasPing, => @trigger() + @listenTo Actions.longPollReceivedRawDeltasPing, (n) => @trigger(n) module.exports = new AccountSidebarLongPollStore() diff --git a/internal_packages/notifications/lib/activity-sidebar.cjsx b/internal_packages/notifications/lib/activity-sidebar.cjsx index de884da63..896d9d1a1 100644 --- a/internal_packages/notifications/lib/activity-sidebar.cjsx +++ b/internal_packages/notifications/lib/activity-sidebar.cjsx @@ -94,7 +94,7 @@ class ActivitySidebar extends React.Component
-
Syncing mail data...
+
Syncing mail data…
_renderTaskActivityItems: => @@ -115,11 +115,11 @@ class ActivitySidebar extends React.Component _renderDeltaSyncActivityItem: =>
-
+
- Getting your mail…this might take a while + Syncing mail data…
@@ -142,14 +142,17 @@ class ActivitySidebar extends React.Component tasks: TaskQueueStatusStore.queue() sync: NylasSyncStatusStore.state() - _onDeltaReceived: => + _onDeltaReceived: (countDeltas) => + tooSmallForNotification = countDeltas <= 10 + return if tooSmallForNotification + if @_timeoutId clearTimeout @_timeoutId @_timeoutId = setTimeout(( => delete @_timeoutId @setState receivingDelta: false - ), 15000) + ), 30000) @setState receivingDelta: true diff --git a/internal_packages/worker-sync/lib/nylas-sync-worker-pool.coffee b/internal_packages/worker-sync/lib/nylas-sync-worker-pool.coffee index 6410c5b3a..ef542183c 100644 --- a/internal_packages/worker-sync/lib/nylas-sync-worker-pool.coffee +++ b/internal_packages/worker-sync/lib/nylas-sync-worker-pool.coffee @@ -64,7 +64,7 @@ class NylasSyncWorkerPool _handleDeltas: (deltas) -> Actions.longPollReceivedRawDeltas(deltas) - Actions.longPollReceivedRawDeltasPing() + Actions.longPollReceivedRawDeltasPing(deltas.length) # Create a (non-enumerable) reference from the attributes which we carry forward # back to their original deltas. This allows us to mark the deltas that the