summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-09-30 11:08:36 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-10-01 08:31:11 -0400
commitc16b9de8dc4924cf2fb243579284e67f55cf3a47 (patch)
treed7780fae809cec0b021281638f25ed7920050b0a /web
parent111fbb2495e88d69bec29971da8ddf086ac3f3b6 (diff)
downloadchat-c16b9de8dc4924cf2fb243579284e67f55cf3a47.tar.gz
chat-c16b9de8dc4924cf2fb243579284e67f55cf3a47.tar.bz2
chat-c16b9de8dc4924cf2fb243579284e67f55cf3a47.zip
Replaced ChannelMember.MarkUnreadLevel with ChannelMember.NotifyProps
Diffstat (limited to 'web')
-rw-r--r--web/react/components/channel_notifications.jsx16
-rw-r--r--web/react/components/notify_counts.jsx2
-rw-r--r--web/react/components/sidebar.jsx2
-rw-r--r--web/react/utils/client.jsx7
4 files changed, 12 insertions, 15 deletions
diff --git a/web/react/components/channel_notifications.jsx b/web/react/components/channel_notifications.jsx
index eaa1c8255..55c0b5438 100644
--- a/web/react/components/channel_notifications.jsx
+++ b/web/react/components/channel_notifications.jsx
@@ -42,7 +42,7 @@ export default class ChannelNotifications extends React.Component {
const member = ChannelStore.getMember(channelId);
var notifyLevel = member.notify_level;
- var markUnreadLevel = member.mark_unread_level;
+ var markUnreadLevel = member.notify_props.mark_unread;
this.setState({
notifyLevel,
@@ -63,7 +63,7 @@ export default class ChannelNotifications extends React.Component {
const member = ChannelStore.getMember(this.state.channelId);
var notifyLevel = member.notify_level;
- var markUnreadLevel = member.mark_unread_level;
+ var markUnreadLevel = member.notify_props.mark_unread;
var newState = this.state;
newState.notifyLevel = notifyLevel;
@@ -249,7 +249,7 @@ export default class ChannelNotifications extends React.Component {
const channelId = this.state.channelId;
const markUnreadLevel = this.state.markUnreadLevel;
- if (ChannelStore.getMember(channelId).mark_unread_level === markUnreadLevel) {
+ if (ChannelStore.getMember(channelId).notify_props.mark_unread === markUnreadLevel) {
this.updateSection('');
return;
}
@@ -257,17 +257,13 @@ export default class ChannelNotifications extends React.Component {
const data = {
channel_id: channelId,
user_id: UserStore.getCurrentId(),
- mark_unread_level: markUnreadLevel
+ mark_unread: markUnreadLevel
};
- if (!data.mark_unread_level || data.mark_unread_level.length === 0) {
- return;
- }
-
- Client.updateMarkUnreadLevel(data,
+ Client.updateNotifyProps(data,
() => {
var member = ChannelStore.getMember(channelId);
- member.mark_unread_level = markUnreadLevel;
+ member.notify_props.mark_unread = markUnreadLevel;
ChannelStore.setChannelMember(member);
this.updateSection('');
},
diff --git a/web/react/components/notify_counts.jsx b/web/react/components/notify_counts.jsx
index 3df661d70..f34b4669f 100644
--- a/web/react/components/notify_counts.jsx
+++ b/web/react/components/notify_counts.jsx
@@ -15,7 +15,7 @@ function getCountsStateFromStores() {
count += channel.total_msg_count - channelMember.msg_count;
} else if (channelMember.mention_count > 0) {
count += channelMember.mention_count;
- } else if (channelMember.mark_unread_level !== 'mention' && channel.total_msg_count - channelMember.msg_count > 0) {
+ } else if (channelMember.notify_props.mark_unread !== 'mention' && channel.total_msg_count - channelMember.msg_count > 0) {
count += 1;
}
});
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 5a4fb1169..821d7fd4a 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -334,7 +334,7 @@ export default class Sidebar extends React.Component {
var unread = false;
if (channelMember) {
msgCount = channel.total_msg_count - channelMember.msg_count;
- unread = (msgCount > 0 && channelMember.mark_unread_level !== 'mention') || channelMember.mention_count > 0;
+ unread = (msgCount > 0 && channelMember.notify_props.mark_unread !== 'mention') || channelMember.mention_count > 0;
}
var titleClass = '';
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);
}
});