[FIX] mail: restrict mention suggestions to channel members

Problem is that when someone is mentionned in a channel he doesn't belong to
(public, private or DM whatever), the message only appears in its Inbox and
he can't know where it comes from nor reply. This is thus very confusing.

With this rev., in Discuss, one can only mention members of the channels.
In the chatter, anyone can be mentionned like before, as when the message
arrives in the Inbox, there is a link to the associated document.
This commit is contained in:
Aaron Bohy
2016-01-25 15:46:56 +01:00
parent da2cbae8f8
commit fc42880da2
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -791,7 +791,7 @@ var chat_manager = {
}));
});
return [members].concat(suggestions);
return [members];
});
}
return channel.members_deferred;
+2 -2
View File
@@ -171,8 +171,8 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
this.searchview = new SearchView(this, dataset, view_id, {}, options);
this.searchview.on('search_data', this, this.on_search);
this.basic_composer = new composer.BasicComposer(this);
this.extended_composer = new composer.ExtendedComposer(this);
this.basic_composer = new composer.BasicComposer(this, {mention_partners_restricted: true});
this.extended_composer = new composer.ExtendedComposer(this, {mention_partners_restricted: true});
this.thread = new ChatThread(this, {
display_help: true,
shorten_messages: false,
+2 -1
View File
@@ -331,6 +331,7 @@ var BasicComposer = Widget.extend({
input_max_height: 150,
input_min_height: 28,
mention_fetch_limit: 8,
mention_partners_restricted: false, // set to true to only suggest prefetched partners
send_text: _('Send'),
});
this.context = this.options.context;
@@ -620,7 +621,7 @@ var BasicComposer = Widget.extend({
}
}
});
if (!suggestions.length) {
if (!suggestions.length && !self.options.mention_partners_restricted) {
// no result found among prefetched partners, fetch other suggestions
var kwargs = {
limit: limit,