diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-08-04 11:38:09 -0400 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2016-08-04 10:38:09 -0500 |
commit | 0184d6059bb1943fb74bf33d1d200a423c5bf5e6 (patch) | |
tree | 4b8480d65d5ec181b372a09f946bb7649809a467 /webapp/actions | |
parent | 9b50b5028391ee29922ad5549b785ac2312be368 (diff) | |
download | chat-0184d6059bb1943fb74bf33d1d200a423c5bf5e6.tar.gz chat-0184d6059bb1943fb74bf33d1d200a423c5bf5e6.tar.bz2 chat-0184d6059bb1943fb74bf33d1d200a423c5bf5e6.zip |
PLT-3506 Added flagged posts functionality (#3679)
* Added flagged posts functionality
* UI Improvements to flags (#3697)
* Added flag functionality for mobile
* Updating flagged text (#3699)
* Add back button to RHS thread when coming from flagged posts
* Updating position of flags (#3708)
* Plt 3506 - Reverting flag position (#3724)
* Revert "Updating position of flags (#3708)"
This reverts commit aaa05632c5d9eda35a048300a5bd7e99584c5b58.
* Fixing the icon in search
* Help text and white space improvements (#3730)
* Updatng help text and some white spacing.
* Updating help text
Diffstat (limited to 'webapp/actions')
-rw-r--r-- | webapp/actions/global_actions.jsx | 3 | ||||
-rw-r--r-- | webapp/actions/post_actions.jsx | 42 |
2 files changed, 41 insertions, 4 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index 829424c1f..9fc9c7b63 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -190,7 +190,8 @@ export function emitPostFocusRightHandSideFromSearch(post, isMentionSearch) { AppDispatcher.handleServerAction({ type: ActionTypes.RECEIVED_POST_SELECTED, postId: Utils.getRootId(post), - from_search: SearchStore.getSearchTerm() + from_search: SearchStore.getSearchTerm(), + from_flagged_posts: SearchStore.getIsFlaggedPosts() }); AppDispatcher.handleServerAction({ diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index 7d830d11b..fd413dfe1 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -9,12 +9,13 @@ import TeamStore from 'stores/team_store.jsx'; import UserStore from 'stores/user_store.jsx'; import * as PostUtils from 'utils/post_utils.jsx'; -import Constants from 'utils/constants.jsx'; -const ActionTypes = Constants.ActionTypes; - import Client from 'client/web_client.jsx'; import * as AsyncClient from 'utils/async_client.jsx'; +import Constants from 'utils/constants.jsx'; +const ActionTypes = Constants.ActionTypes; +const Preferences = Constants.Preferences; + export function handleNewPost(post, msg) { if (ChannelStore.getCurrentId() === post.channel_id) { if (window.isActive) { @@ -116,3 +117,38 @@ export function setUnreadPost(channelId, postId) { ChannelStore.emitLastViewed(lastViewed, ownNewMessage); } } + +export function flagPost(postId) { + AsyncClient.savePreference(Preferences.CATEGORY_FLAGGED_POST, postId, 'true'); +} + +export function unflagPost(postId, success) { + const pref = { + user_id: UserStore.getCurrentId(), + category: Preferences.CATEGORY_FLAGGED_POST, + name: postId + }; + AsyncClient.deletePreferences([pref], success); +} + +export function getFlaggedPosts() { + Client.getFlaggedPosts(0, Constants.POST_CHUNK_SIZE, + (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_SEARCH, + results: data, + is_flagged_posts: true + }); + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_SEARCH_TERM, + term: null, + do_search: false, + is_mention_search: false + }); + }, + (err) => { + AsyncClient.dispatchError(err, 'getFlaggedPosts'); + } + ); +} |