diff options
author | Mika Andrianarijaona <mikaoelitiana@users.noreply.github.com> | 2017-01-13 16:48:49 +0300 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2017-01-13 10:48:49 -0300 |
commit | e69809dce3708b7ba28a7475c8babbb429ca601c (patch) | |
tree | d4e677245959abe583b140feb25fba607cd83e18 /webapp/actions/post_actions.jsx | |
parent | 6c814c72ec8fc5ec5f17c657d2af8fafa67b1e33 (diff) | |
download | chat-e69809dce3708b7ba28a7475c8babbb429ca601c.tar.gz chat-e69809dce3708b7ba28a7475c8babbb429ca601c.tar.bz2 chat-e69809dce3708b7ba28a7475c8babbb429ca601c.zip |
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
Diffstat (limited to 'webapp/actions/post_actions.jsx')
-rw-r--r-- | webapp/actions/post_actions.jsx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index 0e48fb0e8..c7a8cf731 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -363,6 +363,21 @@ export function createPost(post, doLoadPost, success, error) { ); } +export function updatePost(post, success) { + Client.updatePost( + post, + () => { + loadPosts(post.channel_id); + + if (success) { + success(); + } + }, + (err) => { + AsyncClient.dispatchError(err, 'updatePost'); + }); +} + export function removePostFromStore(post) { PostStore.removePost(post); PostStore.emitChange(); |