Этот коммит содержится в:
коммит произвёл
enahum
родитель
2c09582d89
Коммит
f0b74e78dd
@@ -260,3 +260,18 @@ export function autocompleteChannels(term, success, error) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateChannelNotifyProps(data, success, error) {
|
||||||
|
Client.updateChannelNotifyProps(data,
|
||||||
|
() => {
|
||||||
|
if (success) {
|
||||||
|
success();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
if (error) {
|
||||||
|
error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import SettingItemMin from 'components/setting_item_min.jsx';
|
import SettingItemMin from 'components/setting_item_min.jsx';
|
||||||
import SettingItemMax from 'components/setting_item_max.jsx';
|
import SettingItemMax from 'components/setting_item_max.jsx';
|
||||||
|
|
||||||
import Client from 'client/web_client.jsx';
|
|
||||||
import ChannelStore from 'stores/channel_store.jsx';
|
import ChannelStore from 'stores/channel_store.jsx';
|
||||||
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
@@ -12,6 +11,8 @@ import React from 'react';
|
|||||||
import {Modal} from 'react-bootstrap';
|
import {Modal} from 'react-bootstrap';
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
|
|
||||||
|
import {updateChannelNotifyProps} from 'actions/channel_actions.jsx';
|
||||||
|
|
||||||
export default class ChannelNotificationsModal extends React.Component {
|
export default class ChannelNotificationsModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -47,26 +48,28 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleSubmitNotifyLevel() {
|
handleSubmitNotifyLevel() {
|
||||||
var channelId = this.props.channel.id;
|
const channelId = this.props.channel.id;
|
||||||
var notifyLevel = this.state.notifyLevel;
|
const notifyLevel = this.state.notifyLevel;
|
||||||
|
const currentUserId = this.props.currentUser.id;
|
||||||
|
|
||||||
if (this.props.channelMember.notify_props.desktop === notifyLevel) {
|
if (this.props.channelMember.notify_props.desktop === notifyLevel) {
|
||||||
this.updateSection('');
|
this.updateSection('');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = {};
|
const data = {
|
||||||
data.channel_id = channelId;
|
channel_id: channelId,
|
||||||
data.user_id = this.props.currentUser.id;
|
user_id: currentUserId,
|
||||||
data.desktop = notifyLevel;
|
desktop: notifyLevel
|
||||||
|
};
|
||||||
|
|
||||||
//TODO: This should be moved to event_helpers
|
updateChannelNotifyProps(data,
|
||||||
Client.updateChannelNotifyProps(data,
|
|
||||||
() => {
|
() => {
|
||||||
// YUCK
|
// YUCK
|
||||||
var member = ChannelStore.getMyMember(channelId);
|
var member = ChannelStore.getMyMember(channelId);
|
||||||
member.notify_props.desktop = notifyLevel;
|
member.notify_props.desktop = notifyLevel;
|
||||||
ChannelStore.storeMyChannelMember(member);
|
ChannelStore.storeMyChannelMember(member);
|
||||||
|
|
||||||
this.updateSection('');
|
this.updateSection('');
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
@@ -257,8 +260,7 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
mark_unread: markUnreadLevel
|
mark_unread: markUnreadLevel
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: This should be fixed, moved to actions
|
updateChannelNotifyProps(data,
|
||||||
Client.updateChannelNotifyProps(data,
|
|
||||||
() => {
|
() => {
|
||||||
// Yuck...
|
// Yuck...
|
||||||
var member = ChannelStore.getMyMember(channelId);
|
var member = ChannelStore.getMyMember(channelId);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user