summaryrefslogtreecommitdiffstats
path: root/webapp/utils/async_client.jsx
diff options
context:
space:
mode:
authorGabin Aureche <gabin.aureche@live.fr>2017-03-13 13:25:08 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-13 12:25:08 +0000
commitfe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81 (patch)
treeb96d457cde64b7397f91028106e93a7f92a179bd /webapp/utils/async_client.jsx
parent482a0fb5fc248b1ec61db35299dc3e6d963ad5ab (diff)
downloadchat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.tar.gz
chat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.tar.bz2
chat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.zip
Add pinned posts (#4217)
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r--webapp/utils/async_client.jsx34
1 files changed, 34 insertions, 0 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index e1449e3c5..f4faba934 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -1607,6 +1607,40 @@ export function deleteEmoji(id) {
);
}
+export function pinPost(channelId, reaction) {
+ Client.pinPost(
+ channelId,
+ reaction,
+ () => {
+ // the "post_edited" websocket event take cares of updating the posts
+ // the action below is mostly dispatched for the RHS to update
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_POST_PINNED
+ });
+ },
+ (err) => {
+ dispatchError(err, 'pinPost');
+ }
+ );
+}
+
+export function unpinPost(channelId, reaction) {
+ Client.unpinPost(
+ channelId,
+ reaction,
+ () => {
+ // the "post_edited" websocket event take cares of updating the posts
+ // the action below is mostly dispatched for the RHS to update
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_POST_UNPINNED
+ });
+ },
+ (err) => {
+ dispatchError(err, 'unpinPost');
+ }
+ );
+}
+
export function saveReaction(channelId, reaction) {
Client.saveReaction(
channelId,