From 7c319f052441c01f7c0ffd744a50b671c785591a Mon Sep 17 00:00:00 2001 From: hmhealey Date: Wed, 23 Sep 2015 11:38:08 -0400 Subject: Removed UI for quiet mode and added UI to set when a channel will be marked unread in the sidebar --- web/react/utils/client.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'web/react/utils') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 715e26197..ce831be0d 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -583,6 +583,21 @@ export function updateNotifyLevel(data, success, error) { }); } +export function updateMarkUnreadLevel(data, success, error) { + $.ajax({ + url: '/api/v1/channels/update_mark_unread_level', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(data), + success, + error: function onError(xhr, status, err) { + var e = handleError('updateMarkUnreadLevel', xhr, status, err); + error(e); + } + }); +} + export function joinChannel(id, success, error) { $.ajax({ url: '/api/v1/channels/' + id + '/join', -- cgit v1.2.3-1-g7c22 From 101068140734ebc1a310560b8719fe21dacfb277 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Wed, 23 Sep 2015 14:44:17 -0400 Subject: Added channel id to updateLastViewed api calls to prevent multiple updates to different channels from clashing --- web/react/utils/async_client.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index ab2965000..7db3ef30d 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -152,21 +152,23 @@ export function getChannel(id) { } export function updateLastViewedAt() { - if (isCallInProgress('updateLastViewed')) { + const channelId = ChannelStore.getCurrentId(); + + if (channelId === null) { return; } - if (ChannelStore.getCurrentId() == null) { + if (isCallInProgress(`updateLastViewed${channelId}`)) { return; } - callTracker.updateLastViewed = utils.getTimestamp(); + callTracker[`updateLastViewed${channelId}`] = utils.getTimestamp(); client.updateLastViewedAt( - ChannelStore.getCurrentId(), - function updateLastViewedAtSuccess() { + channelId, + () => { callTracker.updateLastViewed = 0; }, - function updateLastViewdAtFailure(err) { + (err) => { callTracker.updateLastViewed = 0; dispatchError(err, 'updateLastViewedAt'); } @@ -634,4 +636,4 @@ export function getMyTeam() { dispatchError(err, 'getMyTeam'); } ); -} \ No newline at end of file +} -- cgit v1.2.3-1-g7c22 From c16b9de8dc4924cf2fb243579284e67f55cf3a47 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Wed, 30 Sep 2015 11:08:36 -0400 Subject: Replaced ChannelMember.MarkUnreadLevel with ChannelMember.NotifyProps --- web/react/utils/client.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index ce831be0d..041c00516 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -568,6 +568,7 @@ export function updateChannelDesc(data, success, error) { track('api', 'api_channels_desc'); } +// TODO remove me export function updateNotifyLevel(data, success, error) { $.ajax({ url: '/api/v1/channels/update_notify_level', @@ -583,16 +584,16 @@ export function updateNotifyLevel(data, success, error) { }); } -export function updateMarkUnreadLevel(data, success, error) { +export function updateNotifyProps(data, success, error) { $.ajax({ - url: '/api/v1/channels/update_mark_unread_level', + url: '/api/v1/channels/update_notify_props', dataType: 'json', contentType: 'application/json', type: 'POST', data: JSON.stringify(data), success, error: function onError(xhr, status, err) { - var e = handleError('updateMarkUnreadLevel', xhr, status, err); + var e = handleError('updateNotifyProps', xhr, status, err); error(e); } }); -- cgit v1.2.3-1-g7c22 From c9a0030551f289241407743fbd21080cd8a358a4 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Wed, 30 Sep 2015 12:28:28 -0400 Subject: Moved ChannelMember.NotifyLevel into ChannelMember.NotifyProps --- web/react/utils/client.jsx | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 041c00516..ea97b6421 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -568,22 +568,6 @@ export function updateChannelDesc(data, success, error) { track('api', 'api_channels_desc'); } -// TODO remove me -export function updateNotifyLevel(data, success, error) { - $.ajax({ - url: '/api/v1/channels/update_notify_level', - dataType: 'json', - contentType: 'application/json', - type: 'POST', - data: JSON.stringify(data), - success, - error: function onError(xhr, status, err) { - var e = handleError('updateNotifyLevel', xhr, status, err); - error(e); - } - }); -} - export function updateNotifyProps(data, success, error) { $.ajax({ url: '/api/v1/channels/update_notify_props', -- cgit v1.2.3-1-g7c22