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.
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
80b2ce9c3f
Коммит
bb69e98631
@@ -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;
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user