summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-10-01 16:01:54 +0200
committerChristophe Simonis <chs@odoo.com>2018-10-01 16:01:54 +0200
commit43b63a04656276926dfecd65d3058d6464ee8ac5 (patch)
treed0f7c5b4a66540fa8422de2be928a30167e45eed /addons/mail/static/src
parentb2870ae1ebc4d198c69142a2399827848d7d30b4 (diff)
parent57e387b645200756c29423af463afe001707f2ac (diff)
[MERGE] forward port branch saas-11.4 up to 57e387b6452
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/followers.js13
-rw-r--r--addons/mail/static/src/js/models/threads/searchable_thread.js2
2 files changed, 14 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/followers.js b/addons/mail/static/src/js/followers.js
index d90b8cce261..9d5ed5424c2 100644
--- a/addons/mail/static/src/js/followers.js
+++ b/addons/mail/static/src/js/followers.js
@@ -204,7 +204,9 @@ var Followers = AbstractField.extend({
return $.when(def).then(function (results) {
if (results) {
self.followers = _.uniq(results.followers.concat(self.followers), 'id');
- self.subtypes = results.subtypes;
+ if (results.subtypes) { //read_followers will return False if current user is not in the list
+ self.subtypes = results.subtypes;
+ }
}
// filter out previously fetched followers that are no longer following
self.followers = _.filter(self.followers, function (follower) {
@@ -291,6 +293,15 @@ var Followers = AbstractField.extend({
});
} else {
var kwargs = _.extend({}, ids);
+ if (follower_id === undefined || follower_id === this.partnerID) {
+ //this.subtypes will only be updated if the current user
+ //just added himself to the followers. We need to update
+ //the subtypes manually when editing subtypes
+ //for current user
+ _.each(this.subtypes, function (subtype) {
+ subtype.followed = checklist.indexOf(subtype.id) > -1;
+ });
+ }
kwargs.subtype_ids = checklist;
kwargs.context = {}; // FIXME
this._rpc({
diff --git a/addons/mail/static/src/js/models/threads/searchable_thread.js b/addons/mail/static/src/js/models/threads/searchable_thread.js
index 5b7157fde5b..17fa119890a 100644
--- a/addons/mail/static/src/js/models/threads/searchable_thread.js
+++ b/addons/mail/static/src/js/models/threads/searchable_thread.js
@@ -165,6 +165,7 @@ var SearchableThread = Thread.extend({
var self = this;
var domain = this._getThreadDomain();
+ var moderatedChannelIds = typeof(this._id) === 'number' ? [this._id] : false;
var cache = this._getCache(pDomain);
if (pDomain) {
@@ -179,6 +180,7 @@ var SearchableThread = Thread.extend({
method: 'message_fetch',
args: [domain],
kwargs: {
+ moderated_channel_ids: moderatedChannelIds,
limit: this._FETCH_LIMIT,
context: session.user_context
},