diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-07-16 15:16:11 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-07-21 11:17:18 -0400 |
commit | e32aee8977bf99b0f5ca446cb028b04c25e2b918 (patch) | |
tree | 45a0a29a18f045c1e0f37ea28689e819e3fdbe3b | |
parent | 7a8ed5cf05c24671af2f1629c454615de9a39545 (diff) | |
download | chat-e32aee8977bf99b0f5ca446cb028b04c25e2b918.tar.gz chat-e32aee8977bf99b0f5ca446cb028b04c25e2b918.tar.bz2 chat-e32aee8977bf99b0f5ca446cb028b04c25e2b918.zip |
Added events for when the active thread (ie the message thread that a user is responding to) changes
-rw-r--r-- | web/react/stores/post_store.jsx | 16 | ||||
-rw-r--r-- | web/react/utils/constants.jsx | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index e773bb688..1f07dca62 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -18,6 +18,7 @@ var SEARCH_TERM_CHANGE_EVENT = 'search_term_change'; var SELECTED_POST_CHANGE_EVENT = 'selected_post_change'; var MENTION_DATA_CHANGE_EVENT = 'mention_data_change'; var ADD_MENTION_EVENT = 'add_mention'; +var ACTIVE_THREAD_CHANGED_EVENT = 'active_thread_changed'; var PostStore = assign({}, EventEmitter.prototype, { @@ -93,6 +94,18 @@ var PostStore = assign({}, EventEmitter.prototype, { this.removeListener(ADD_MENTION_EVENT, callback); }, + emitActiveThreadChanged: function(rootId, parentId) { + this.emit(ACTIVE_THREAD_CHANGED_EVENT, rootId, parentId); + }, + + addActiveThreadChangedListener: function(callback) { + this.on(ACTIVE_THREAD_CHANGED_EVENT, callback); + }, + + removeActiveThreadChangedListener: function(callback) { + this.removeListener(ACTIVE_THREAD_CHANGED_EVENT, callback); + }, + getCurrentPosts: function() { var currentId = ChannelStore.getCurrentId(); @@ -186,6 +199,9 @@ PostStore.dispatchToken = AppDispatcher.register(function(payload) { case ActionTypes.RECIEVED_ADD_MENTION: PostStore.emitAddMention(action.id, action.username); break; + case ActionTypes.RECEIVED_ACTIVE_THREAD_CHANGED: + PostStore.emitActiveThreadChanged(action.root_id, action.parent_id); + break; default: } diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index 3aadfb4b0..943787630 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -18,6 +18,7 @@ module.exports = { RECIEVED_POST_SELECTED: null, RECIEVED_MENTION_DATA: null, RECIEVED_ADD_MENTION: null, + RECEIVED_ACTIVE_THREAD_CHANGED: null, RECIEVED_PROFILES: null, RECIEVED_ME: null, |