summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/search_store.jsx2
-rw-r--r--webapp/stores/suggestion_store.jsx18
2 files changed, 19 insertions, 1 deletions
diff --git a/webapp/stores/search_store.jsx b/webapp/stores/search_store.jsx
index 5dfea6867..d57c630cb 100644
--- a/webapp/stores/search_store.jsx
+++ b/webapp/stores/search_store.jsx
@@ -122,7 +122,7 @@ class SearchStoreClass extends EventEmitter {
updatePost(post) {
const results = this.getSearchResults();
- if (results == null) {
+ if (!post || results == null) {
return;
}
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;
}
}
}