diff --git a/addons/hr_holidays/models/mail_channel.py b/addons/hr_holidays/models/mail_channel.py index c5dd68986d7..3e29066bf08 100644 --- a/addons/hr_holidays/models/mail_channel.py +++ b/addons/hr_holidays/models/mail_channel.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, fields, models +from odoo import fields, models class Channel(models.Model): @@ -9,7 +9,7 @@ class Channel(models.Model): def partner_info(self, all_partners, direct_partners): partner_infos = super(Channel, self).partner_info(all_partners, direct_partners) - # only search for leave out_of_office_message if im_status is on leave + # only search for leave out_of_office_date_end if im_status is on leave partners_on_leave = [partner_id for partner_id in direct_partners.ids if 'leave' in partner_infos[partner_id]['im_status']] if partners_on_leave: now = fields.Datetime.now() diff --git a/addons/mail/__manifest__.py b/addons/mail/__manifest__.py index 0eaa6a216a0..c3dd33c9aa3 100644 --- a/addons/mail/__manifest__.py +++ b/addons/mail/__manifest__.py @@ -59,7 +59,6 @@ 'static/src/xml/thread.xml', 'static/src/xml/abstract_thread_window.xml', 'static/src/xml/thread_window.xml', - 'static/src/xml/user_menu.xml', 'static/src/xml/web_kanban_activity.xml', 'static/src/xml/text_emojis.xml', ], diff --git a/addons/mail/models/ir_http.py b/addons/mail/models/ir_http.py index 7285b3447b0..400b8dee7d8 100644 --- a/addons/mail/models/ir_http.py +++ b/addons/mail/models/ir_http.py @@ -12,6 +12,5 @@ class IrHttp(models.AbstractModel): user = request.env.user result = super(IrHttp, self).session_info() if self.env.user.has_group('base.group_user'): - result['out_of_office_message'] = user.out_of_office_message result['notification_type'] = user.notification_type return result diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index ea1174c52ea..043bf10dfe2 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -504,18 +504,16 @@ class Channel(models.Model): Return the information needed by channel to display channel members :param all_partners: list of res.parner(): :param direct_partners: list of res.parner(): - :returns: a list of {'id', 'name', 'email'} for each partner and adds {im_status, out_of_office_message} for direct_partners. + :returns: a list of {'id', 'name', 'email'} for each partner and adds {im_status} for direct_partners. :rtype : list(dict) """ partner_infos = {partner['id']: partner for partner in all_partners.sudo().read(['id', 'name', 'email'])} - # add im _status and out_of_office_message for direct_partners + # add im _status for direct_partners direct_partners_im_status = {partner['id']: partner for partner in direct_partners.sudo().read(['im_status'])} for i in direct_partners_im_status.keys(): partner_infos[i].update(direct_partners_im_status[i]) - for user in self.env['res.users'].search([('partner_id', 'in', direct_partners.ids), ('out_of_office_message', '!=', False)]): - partner_infos[user.partner_id.id]['out_of_office_message'] = user.out_of_office_message return partner_infos def channel_info(self, extra_info=False): diff --git a/addons/mail/models/res_users.py b/addons/mail/models/res_users.py index 7be2aa7e52b..d7b414eac7c 100644 --- a/addons/mail/models/res_users.py +++ b/addons/mail/models/res_users.py @@ -38,7 +38,6 @@ class Users(models.Model): moderation_channel_ids = fields.Many2many( 'mail.channel', 'mail_channel_moderator_rel', string='Moderated channels') - out_of_office_message = fields.Char(string='Chat Status') @api.depends('moderation_channel_ids.moderation', 'moderation_channel_ids.moderator_ids') def _compute_is_moderator(self): @@ -73,10 +72,10 @@ GROUP BY channel_moderator.res_users_id""", [tuple(self.ids)]) init_res = super(Users, self).__init__(pool, cr) # duplicate list to avoid modifying the original reference type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) - type(self).SELF_WRITEABLE_FIELDS.extend(['notification_type', 'out_of_office_message']) + type(self).SELF_WRITEABLE_FIELDS.extend(['notification_type']) # duplicate list to avoid modifying the original reference type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) - type(self).SELF_READABLE_FIELDS.extend(['notification_type', 'out_of_office_message']) + type(self).SELF_READABLE_FIELDS.extend(['notification_type']) return init_res @api.model diff --git a/addons/mail/static/src/js/models/threads/abstract_thread.js b/addons/mail/static/src/js/models/threads/abstract_thread.js index 6961ba48175..ed10e761d62 100644 --- a/addons/mail/static/src/js/models/threads/abstract_thread.js +++ b/addons/mail/static/src/js/models/threads/abstract_thread.js @@ -82,14 +82,6 @@ var AbstractThread = Class.extend(Mixins.EventDispatcherMixin, { getOutOfOfficeInfo: function () { return undefined; }, - /** - * By default, threads do not have out-of-office feature - * - * @return {string|undefined} - */ - getOutOfOfficeMessage: function () { - return undefined; - }, /** * Get the status of the thread (e.g. 'online', 'offline', etc.) * @@ -122,7 +114,7 @@ var AbstractThread = Class.extend(Mixins.EventDispatcherMixin, { * @return {boolean} */ hasOutOfOffice() { - return !!(this.getOutOfOfficeMessage() || this.getOutOfOfficeInfo()); + return !!this.getOutOfOfficeInfo(); }, /** * States whether this thread is compatible with the 'seen' feature. diff --git a/addons/mail/static/src/js/models/threads/dm_chat.js b/addons/mail/static/src/js/models/threads/dm_chat.js index 6b56cd2c80d..b811b5a5cd5 100644 --- a/addons/mail/static/src/js/models/threads/dm_chat.js +++ b/addons/mail/static/src/js/models/threads/dm_chat.js @@ -23,7 +23,6 @@ var DMChat = TwoUserChannel.extend(ChannelSeenMixin, { * @param {integer} params.data.direct_partner[0].id * @param {string} params.data.direct_partner[0].im_status * @param {string} params.data.direct_partner[0].name - * @param {string} [params.data.direct_partner[0].out_of_office_message] * @param {string} [params.data.direct_partner[0].out_of_office_date_end] */ init: function (params) { @@ -34,7 +33,6 @@ var DMChat = TwoUserChannel.extend(ChannelSeenMixin, { this._directPartnerID = data.direct_partner[0].id; this._name = data.custom_channel_name || data.direct_partner[0].name; - this._outOfOfficeMessage = data.direct_partner[0].out_of_office_message; this._outOfOfficeDateEnd = data.direct_partner[0].out_of_office_date_end; this._type = 'dm_chat'; @@ -77,15 +75,6 @@ var DMChat = TwoUserChannel.extend(ChannelSeenMixin, { var formattedDate = date.toLocaleDateString(window.navigator.language, options); return _.str.sprintf(_t("Out of office until %s"), formattedDate); }, - /** - * Get the out of office message of the thread - * - * @override {mail.model.AbstractThread} - * @returns {string} - */ - getOutOfOfficeMessage: function () { - return this._outOfOfficeMessage; - }, /** * @override */ @@ -104,11 +93,9 @@ var DMChat = TwoUserChannel.extend(ChannelSeenMixin, { /** * @param {Object} data - * @param {string} data.outOfOfficeMessage * @param {string} data.outOfOfficeDateEnd */ updateOutOfOfficeInfo: function (data) { - this._outOfOfficeMessage = data.outOfOfficeMessage; this._outOfOfficeDateEnd = data.outOfOfficeDateEnd; this.call('mail_service', 'getMailBus').trigger('updated_out_of_office', { threadID: this.getID(), diff --git a/addons/mail/static/src/js/services/mail_status_manager.js b/addons/mail/static/src/js/services/mail_status_manager.js index a40299a02d5..184499e8bb4 100644 --- a/addons/mail/static/src/js/services/mail_status_manager.js +++ b/addons/mail/static/src/js/services/mail_status_manager.js @@ -87,7 +87,6 @@ MailManager.include({ return; } dmChat.updateOutOfOfficeInfo({ - outOfOfficeMessage: channelInfo.direct_partner[0].out_of_office_message, outOfOfficeDateEnd: channelInfo.direct_partner[0].out_of_office_date_end, }); }); diff --git a/addons/mail/static/src/js/thread_windows/thread_window.js b/addons/mail/static/src/js/thread_windows/thread_window.js index f7f0c23dd7b..4bd1e6c15ff 100644 --- a/addons/mail/static/src/js/thread_windows/thread_window.js +++ b/addons/mail/static/src/js/thread_windows/thread_window.js @@ -24,7 +24,6 @@ var ThreadWindow = AbstractThreadWindow.extend({ 'click .o_mail_thread': '_onThreadWindowFocus', 'click .o_thread_composer': '_onThreadWindowFocus', 'click .o_thread_window_expand': '_onClickExpand', - 'click .o_out_of_office_read_more_less_button': '_onClickOutOfOfficeReadMoreLess', }), /** * Version of thread window that supports {mail.model.Thread} @@ -92,8 +91,6 @@ var ThreadWindow = AbstractThreadWindow.extend({ self.$input = self.$('.o_composer_text_field'); }); } - this._updateOutOfOfficeReadMoreLessButton(); - return Promise.all([superDef, composerDef]); }, @@ -262,19 +259,6 @@ var ThreadWindow = AbstractThreadWindow.extend({ }) .focus(); }, - /** - * @private - */ - _updateOutOfOfficeReadMoreLessButton: function () { - var $readMore = this.$('.o_out_of_office_text'); - var isOverflowing = $readMore.prop('scrollWidth') > $readMore.width(); - var isOverflowShown = !$readMore.hasClass('o_text_wrap'); - if (isOverflowing || isOverflowShown) { - var $button = this.$('.o_out_of_office_read_more_less_button'); - $button.show(); - $button.text(isOverflowing ? _t('Read more') : _t('Read less')); - } - }, //-------------------------------------------------------------------------- // Handlers @@ -313,15 +297,6 @@ var ThreadWindow = AbstractThreadWindow.extend({ }); } }, 1000, true), - /** - * @private - * @param {MouseEvent} ev - */ - _onClickOutOfOfficeReadMoreLess: function (ev) { - ev.preventDefault(); - this.$('.o_out_of_office_text').toggleClass('o_text_wrap'); - this._updateOutOfOfficeReadMoreLessButton(); - }, /** * @override * @private diff --git a/addons/mail/static/src/js/user_menu.js b/addons/mail/static/src/js/user_menu.js deleted file mode 100644 index 77235c1f166..00000000000 --- a/addons/mail/static/src/js/user_menu.js +++ /dev/null @@ -1,22 +0,0 @@ -odoo.define('mail.UserMenu', function (require) { -"use strict"; - -/** - * This file includes the UserMenu widget defined in Community to add or - * override actions only available in Enterprise. - */ - -var UserMenu = require('web.UserMenu'); - -UserMenu.include({ - /** - * @override - */ - init: function () { - this._super.apply(this, arguments); - var session = this.getSession(); - this.outOfOfficeMessage = session.out_of_office_message; - }, -}); - -}); diff --git a/addons/mail/static/src/scss/out_of_office.scss b/addons/mail/static/src/scss/out_of_office.scss index 7ddbdd5d355..bcdb3a182f7 100644 --- a/addons/mail/static/src/scss/out_of_office.scss +++ b/addons/mail/static/src/scss/out_of_office.scss @@ -5,15 +5,4 @@ .o_out_of_office_info { font-weight: bold; } - .o_out_of_office_text { - word-wrap: break-word; - overflow: hidden; - text-overflow: ellipsis; - } - .o_text_wrap { - white-space: nowrap; - } - .o_out_of_office_read_more_less_button { - display: none; - } } diff --git a/addons/mail/static/src/xml/out_of_office.xml b/addons/mail/static/src/xml/out_of_office.xml index 89723daf5dc..19fb2c341c6 100644 --- a/addons/mail/static/src/xml/out_of_office.xml +++ b/addons/mail/static/src/xml/out_of_office.xml @@ -5,9 +5,5 @@ -->