summaryrefslogtreecommitdiffstats
path: root/webapp/actions
diff options
context:
space:
mode:
authorMika Andrianarijaona <mikaoelitiana@users.noreply.github.com>2017-01-13 16:48:49 +0300
committerenahum <nahumhbl@gmail.com>2017-01-13 10:48:49 -0300
commite69809dce3708b7ba28a7475c8babbb429ca601c (patch)
treed4e677245959abe583b140feb25fba607cd83e18 /webapp/actions
parent6c814c72ec8fc5ec5f17c657d2af8fafa67b1e33 (diff)
downloadchat-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')
-rw-r--r--webapp/actions/post_actions.jsx15
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();