From e69809dce3708b7ba28a7475c8babbb429ca601c Mon Sep 17 00:00:00 2001 From: Mika Andrianarijaona Date: Fri, 13 Jan 2017 16:48:49 +0300 Subject: GH-4907 Move Client.updatePost call into an action (#5045) * move Client.updatePost into an action Client.updatePost where called from components so they needed to be moved inside action and call that action from component instead fixes #4907 * move loadPost in updatePost callback * Add loadPosts call in updatePost action * Lint: remove trailing spaces --- webapp/components/edit_post_modal.jsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/edit_post_modal.jsx b/webapp/components/edit_post_modal.jsx index 2108ec3d1..55bf5fe60 100644 --- a/webapp/components/edit_post_modal.jsx +++ b/webapp/components/edit_post_modal.jsx @@ -9,11 +9,9 @@ import MessageHistoryStore from 'stores/message_history_store.jsx'; import PreferenceStore from 'stores/preference_store.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; -import {loadPosts} from 'actions/post_actions.jsx'; +import {updatePost} from 'actions/post_actions.jsx'; -import Client from 'client/web_client.jsx'; import * as UserAgent from 'utils/user_agent.jsx'; -import * as AsyncClient from 'utils/async_client.jsx'; import * as Utils from 'utils/utils.jsx'; import Constants from 'utils/constants.jsx'; const KeyCodes = Constants.KeyCodes; @@ -91,16 +89,11 @@ export default class EditPostModal extends React.Component { return; } - Client.updatePost( + updatePost( updatedPost, () => { - loadPosts(updatedPost.channel_id); window.scrollTo(0, 0); - }, - (err) => { - AsyncClient.dispatchError(err, 'updatePost'); - } - ); + }); $('#edit_post').modal('hide'); } -- cgit v1.2.3-1-g7c22