diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-01-23 18:03:57 +0900 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-01-23 09:03:57 +0000 |
commit | efbaa1eb035052cb3f52d9e8df6bd0a3ce70fcfd (patch) | |
tree | 8b86d8b9aa95081bdf8e8827ffe230ea279c0147 /webapp | |
parent | 9b0ac631335bd9d2232389e26b58eee5b30ed00a (diff) | |
download | chat-efbaa1eb035052cb3f52d9e8df6bd0a3ce70fcfd.tar.gz chat-efbaa1eb035052cb3f52d9e8df6bd0a3ce70fcfd.tar.bz2 chat-efbaa1eb035052cb3f52d9e8df6bd0a3ce70fcfd.zip |
Move instances of Client.updateUserNotifyProps() in components to an action (#5156)
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/actions/user_actions.jsx | 18 | ||||
-rw-r--r-- | webapp/components/user_settings/user_settings_notifications.jsx | 7 |
2 files changed, 21 insertions, 4 deletions
diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx index 76879b5f5..94546cf36 100644 --- a/webapp/actions/user_actions.jsx +++ b/webapp/actions/user_actions.jsx @@ -453,6 +453,24 @@ export function generateMfaSecret(success, error) { ); } +export function updateUserNotifyProps(data, success, error) { + Client.updateUserNotifyProps( + data, + () => { + AsyncClient.getMe(); + + if (success) { + success(); + } + }, + (err) => { + if (error) { + error(err); + } + } + ); +} + export function updateUserRoles(userId, newRoles, success, error) { Client.updateUserRoles( userId, diff --git a/webapp/components/user_settings/user_settings_notifications.jsx b/webapp/components/user_settings/user_settings_notifications.jsx index 2ee33c092..672f8d6b7 100644 --- a/webapp/components/user_settings/user_settings_notifications.jsx +++ b/webapp/components/user_settings/user_settings_notifications.jsx @@ -8,10 +8,9 @@ import DesktopNotificationSettings from './desktop_notification_settings.jsx'; import UserStore from 'stores/user_store.jsx'; -import Client from 'client/web_client.jsx'; -import * as AsyncClient from 'utils/async_client.jsx'; import * as Utils from 'utils/utils.jsx'; import Constants from 'utils/constants.jsx'; +import {updateUserNotifyProps} from 'actions/user_actions.jsx'; import EmailNotificationSetting from './email_notification_setting.jsx'; import {FormattedMessage} from 'react-intl'; @@ -143,10 +142,10 @@ export default class NotificationsTab extends React.Component { data.first_name = this.state.firstNameKey.toString(); data.channel = this.state.channelKey.toString(); - Client.updateUserNotifyProps(data, + updateUserNotifyProps( + data, () => { this.props.updateSection(''); - AsyncClient.getMe(); $('.settings-modal .modal-body').scrollTop(0).perfectScrollbar('update'); }, (err) => { |