summaryrefslogtreecommitdiffstats
path: root/webapp/components/textbox.jsx
diff options
context:
space:
mode:
authorYi EungJun <semtlenori@gmail.com>2016-09-20 06:41:19 +0900
committerHarrison Healey <harrisonmhealey@gmail.com>2016-09-19 17:41:19 -0400
commitbb69e98631b2541954b6ae465b8ba5f788b9dc49 (patch)
tree125fac51e896af3b254825a029653d86395f9d2b /webapp/components/textbox.jsx
parent80b2ce9c3f88f96a1972232607544d347f54fff7 (diff)
downloadchat-bb69e98631b2541954b6ae465b8ba5f788b9dc49.tar.gz
chat-bb69e98631b2541954b6ae465b8ba5f788b9dc49.tar.bz2
chat-bb69e98631b2541954b6ae465b8ba5f788b9dc49.zip
PLT-4182 Fix incorrect listing for at-mention in comment (#4031)
* Add missing eol * PLT-4182 Fix incorrect listing for at-mention in comment Suggestion box for at-mention listed users for the center channel even if the current textbox is for reply for a post which belongs to a different channel.
Diffstat (limited to 'webapp/components/textbox.jsx')
-rw-r--r--webapp/components/textbox.jsx18
1 files changed, 17 insertions, 1 deletions
diff --git a/webapp/components/textbox.jsx b/webapp/components/textbox.jsx
index 5c1d823b5..22738ffa3 100644
--- a/webapp/components/textbox.jsx
+++ b/webapp/components/textbox.jsx
@@ -36,7 +36,11 @@ export default class Textbox extends React.Component {
connection: ''
};
- this.suggestionProviders = [new AtMentionProvider(), new ChannelMentionProvider(), new EmoticonProvider()];
+ this.suggestionProviders = [
+ new AtMentionProvider(this.props.channelId),
+ new ChannelMentionProvider(),
+ new EmoticonProvider()
+ ];
if (props.supportsCommands) {
this.suggestionProviders.push(new CommandProvider());
}
@@ -104,6 +108,18 @@ export default class Textbox extends React.Component {
this.setState({preview: !this.state.preview});
}
+ componentWillReceiveProps(nextProps) {
+ if (nextProps.channelId !== this.channelId) {
+ // Update channel id for AtMentionProvider.
+ const providers = this.suggestionProviders;
+ for (let i = 0; i < providers.length; i++) {
+ if (providers[i] instanceof AtMentionProvider) {
+ providers[i] = new AtMentionProvider(nextProps.channelId);
+ }
+ }
+ }
+ }
+
render() {
const hasText = this.props.messageText.length > 0;