summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2016-01-21 16:00:12 +0100
committerAaron Bohy <aab@odoo.com>2016-01-25 15:46:56 +0100
commitfc42880da276736992d9cbc20fb423edb16a7d21 (patch)
treed212c18c4017618170b3cf1705c329e7d5f4b43a /addons/mail/static/src
parentda2cbae8f8a1e9a04a79471416b115eb0472921a (diff)
[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.
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/chat_manager.js2
-rw-r--r--addons/mail/static/src/js/client_action.js4
-rw-r--r--addons/mail/static/src/js/composer.js3
3 files changed, 5 insertions, 4 deletions
diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js
index 82299475db1..f425a4718f9 100644
--- a/addons/mail/static/src/js/chat_manager.js
+++ b/addons/mail/static/src/js/chat_manager.js
@@ -791,7 +791,7 @@ var chat_manager = {
}));
});
- return [members].concat(suggestions);
+ return [members];
});
}
return channel.members_deferred;
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js
index e091590faa1..82b36f3425d 100644
--- a/addons/mail/static/src/js/client_action.js
+++ b/addons/mail/static/src/js/client_action.js
@@ -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,
diff --git a/addons/mail/static/src/js/composer.js b/addons/mail/static/src/js/composer.js
index dae8cdc4241..5d6de2bad50 100644
--- a/addons/mail/static/src/js/composer.js
+++ b/addons/mail/static/src/js/composer.js
@@ -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,