Moved ChannelMember.NotifyLevel into ChannelMember.NotifyProps
Этот коммит содержится в:
@@ -41,7 +41,7 @@ export default class ChannelNotifications extends React.Component {
|
||||
var channelId = button.getAttribute('data-channelid');
|
||||
|
||||
const member = ChannelStore.getMember(channelId);
|
||||
var notifyLevel = member.notify_level;
|
||||
var notifyLevel = member.notify_props.desktop;
|
||||
var markUnreadLevel = member.notify_props.mark_unread;
|
||||
|
||||
this.setState({
|
||||
@@ -62,7 +62,7 @@ export default class ChannelNotifications extends React.Component {
|
||||
}
|
||||
|
||||
const member = ChannelStore.getMember(this.state.channelId);
|
||||
var notifyLevel = member.notify_level;
|
||||
var notifyLevel = member.notify_props.desktop;
|
||||
var markUnreadLevel = member.notify_props.mark_unread;
|
||||
|
||||
var newState = this.state;
|
||||
@@ -81,7 +81,7 @@ export default class ChannelNotifications extends React.Component {
|
||||
var channelId = this.state.channelId;
|
||||
var notifyLevel = this.state.notifyLevel;
|
||||
|
||||
if (ChannelStore.getMember(channelId).notify_level === notifyLevel) {
|
||||
if (ChannelStore.getMember(channelId).notify_props.desktop === notifyLevel) {
|
||||
this.updateSection('');
|
||||
return;
|
||||
}
|
||||
@@ -89,16 +89,12 @@ export default class ChannelNotifications extends React.Component {
|
||||
var data = {};
|
||||
data.channel_id = channelId;
|
||||
data.user_id = UserStore.getCurrentId();
|
||||
data.notify_level = notifyLevel;
|
||||
data.desktop = notifyLevel;
|
||||
|
||||
if (!data.notify_level || data.notify_level.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Client.updateNotifyLevel(data,
|
||||
Client.updateNotifyProps(data,
|
||||
() => {
|
||||
var member = ChannelStore.getMember(channelId);
|
||||
member.notify_level = notifyLevel;
|
||||
member.notify_props.desktop = notifyLevel;
|
||||
ChannelStore.setChannelMember(member);
|
||||
this.updateSection('');
|
||||
},
|
||||
|
||||
@@ -203,7 +203,7 @@ export default class Sidebar extends React.Component {
|
||||
const user = UserStore.getCurrentUser();
|
||||
const member = ChannelStore.getMember(msg.channel_id);
|
||||
|
||||
var notifyLevel = member.notify_level;
|
||||
var notifyLevel = member.notify_props.desktop;
|
||||
if (notifyLevel === 'default') {
|
||||
notifyLevel = user.notify_props.desktop;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
Ссылка в новой задаче
Block a user