summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/messages/message.js
diff options
context:
space:
mode:
authorNikunj Ladava <nla@odoo.com>2018-02-02 06:21:44 +0000
committerXavier-Do <xdo@odoo.com>2019-08-05 11:50:19 +0000
commit0c37b9fb39005eab70ee8b39da84f79c981b2695 (patch)
treef365ab14cca2a776cb0c91587f841ba95257f8de /addons/mail/static/src/js/models/messages/message.js
parent634bdbfa3a316fcaa9323f97bb59f198cd771b27 (diff)
[IMP] mail, test_mail: new 'History' mailbox in Discuss
This commit adds a new mailbox in the Discuss app called 'History'. Messages that have been marked as read are moved to 'History'. Notifications are required to link history messages to users. So notifications are now deleted after they are more tha 6 months old. This means History mailbox keeps less than 6 months old messages. Note that this feature only works when user notifications are handled in Odoo. This can be set in the user preferences, under the "Notification Management" section. Task-ID 402597
Diffstat (limited to 'addons/mail/static/src/js/models/messages/message.js')
-rw-r--r--addons/mail/static/src/js/models/messages/message.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/models/messages/message.js b/addons/mail/static/src/js/models/messages/message.js
index d22569461e5..e5470d219a2 100644
--- a/addons/mail/static/src/js/models/messages/message.js
+++ b/addons/mail/static/src/js/models/messages/message.js
@@ -32,6 +32,7 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
* @param {string} [data.moderation_status='accepted']
* @param {string} [data.module_icon]
* @param {Array} [data.needaction_partner_ids = []]
+ * @param {Array} [data.history_partner_ids = []]
* @param {string} [data.record_name]
* @param {integer} [data.res_id]
* @param {Array} [data.starred_partner_ids = []]
@@ -648,6 +649,9 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
if (_.contains(this._starredPartnerIDs, session.partner_id)) {
this.setStarred(true);
}
+ if (_.contains(this._historyPartnerIDs, session.partner_id)) {
+ this._setHistory(true);
+ }
if (
this.originatesFromChannel() &&
_.contains(
@@ -739,6 +743,7 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
* @param {string} [data.moderation_status='accepted']
* @param {string} [data.module_icon]
* @param {Array} [data.needaction_partner_ids = []]
+ * @param {Array} [data.history_partner_ids = []]
* @param {string} [data.record_name]
* @param {integer} [data.res_id]
* @param {Array} [data.starred_partner_ids = []]
@@ -757,6 +762,7 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
this._moduleIcon = data.module_icon;
this._needactionPartnerIDs = data.needaction_partner_ids || [];
this._starredPartnerIDs = data.starred_partner_ids || [];
+ this._historyPartnerIDs = data.history_partner_ids || [];
this._subject = data.subject;
this._subtypeDescription = data.subtype_description;
this._threadIDs = data.channel_ids || [];
@@ -764,6 +770,21 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
this._moderationStatus = data.moderation_status || 'accepted';
},
+ /*
+ * Set whether the message is history or not.
+ * If it is history, the message is moved to the "History" mailbox.
+ * Note that this function only applies it locally, the server is not aware
+ *
+ * @private
+ * @param {boolean} history if set, the message is history
+ */
+ _setHistory: function (history) {
+ if (history) {
+ this._addThread('mailbox_history');
+ } else {
+ this.removeThread('mailbox_history');
+ }
+ },
/**
* Set whether the message is moderated by current user or not.
* If it is moderated by the current user, the message is moved to the