diff options
author | David Meza <dmeza@users.noreply.github.com> | 2017-07-31 07:24:13 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-07-31 08:24:13 -0400 |
commit | f740698dbe06816921d2a20eea876c9ca7b515ed (patch) | |
tree | df5c9f4f076c6294da8246275a97133f59b5a82f /webapp/stores/suggestion_store.jsx | |
parent | 22fa48f455f15be7a7528501431841a2c7d84c85 (diff) | |
download | chat-f740698dbe06816921d2a20eea876c9ca7b515ed.tar.gz chat-f740698dbe06816921d2a20eea876c9ca7b515ed.tar.bz2 chat-f740698dbe06816921d2a20eea876c9ca7b515ed.zip |
PLT-6486 Add an `@username` button to the profile popover, that puts the username in the post when clicked (#6349)
* PLT-6486 Add an `@username` button to the profile popover, that puts the username in the post when clicked
* PLT-6486 Display `@username` mention on the right text area on center or RHS.
* Disable @mentions from profile popover on searches, mentions and pinned posts. Fix js errors.
* Control undefined post in SearchStore that causes an exception.
Diffstat (limited to 'webapp/stores/suggestion_store.jsx')
-rw-r--r-- | webapp/stores/suggestion_store.jsx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/webapp/stores/suggestion_store.jsx b/webapp/stores/suggestion_store.jsx index d1f5a64f6..902886ed7 100644 --- a/webapp/stores/suggestion_store.jsx +++ b/webapp/stores/suggestion_store.jsx @@ -10,6 +10,7 @@ const ActionTypes = Constants.ActionTypes; const COMPLETE_WORD_EVENT = 'complete_word'; const PRETEXT_CHANGED_EVENT = 'pretext_changed'; const SUGGESTIONS_CHANGED_EVENT = 'suggestions_changed'; +const POPOVER_MENTION_KEY_CLICK_EVENT = 'popover_mention_key_click'; class SuggestionStore extends EventEmitter { constructor() { @@ -27,6 +28,10 @@ class SuggestionStore extends EventEmitter { this.removeCompleteWordListener = this.removeCompleteWordListener.bind(this); this.emitCompleteWord = this.emitCompleteWord.bind(this); + this.addPopoverMentionKeyClickListener = this.addPopoverMentionKeyClickListener.bind(this); + this.removePopoverMentionKeyClickListener = this.removePopoverMentionKeyClickListener.bind(this); + this.emitPopoverMentionKeyClick = this.emitPopoverMentionKeyClick.bind(this); + this.handleEventPayload = this.handleEventPayload.bind(this); this.dispatchToken = AppDispatcher.register(this.handleEventPayload); @@ -71,6 +76,16 @@ class SuggestionStore extends EventEmitter { this.emit(COMPLETE_WORD_EVENT + id, term, matchedPretext); } + addPopoverMentionKeyClickListener(id, callback) { + this.on(POPOVER_MENTION_KEY_CLICK_EVENT + id, callback); + } + removePopoverMentionKeyClickListener(id, callback) { + this.removeListener(POPOVER_MENTION_KEY_CLICK_EVENT + id, callback); + } + emitPopoverMentionKeyClick(isRHS, mentionKey) { + this.emit(POPOVER_MENTION_KEY_CLICK_EVENT + isRHS, mentionKey); + } + registerSuggestionBox(id) { this.suggestions.set(id, { pretext: '', @@ -304,6 +319,9 @@ class SuggestionStore extends EventEmitter { this.completeWord(id, other.term, other.matchedPretext); } break; + case ActionTypes.POPOVER_MENTION_KEY_CLICK: + this.emitPopoverMentionKeyClick(other.isRHS, other.mentionKey); + break; } } } |