diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-08-28 10:16:37 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-28 13:43:54 +0000 |
| commit | f9ee1cf5f904116e4d1d70a8eaf4ee1d58b18a3a (patch) | |
| tree | 89425d0677083bb9489e42d47521c4bcf1e4ff44 /addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js | |
| parent | 98e12901c97a67dc87f21647473754cd6f384d4a (diff) | |
[FIX] mail, *: rename thread viewer to thread view
The "viewer" should be the "parent" not the view itself. This distinction will
become important in a future commit to allow viewers to not display the view in
some situations.
Rename done as a standalone commit to ease diff readability.
Part of task-2310623
closes odoo/odoo#56737
X-original-commit: 1b811e6a972d72de02965adda67c5b039bee023f
Related: odoo/enterprise#12756
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js')
| -rw-r--r-- | addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js b/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js deleted file mode 100644 index 01fd38912a1..00000000000 --- a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js +++ /dev/null @@ -1,58 +0,0 @@ -odoo.define('hr_holidays/static/src/components/thread_viewer/thread_viewer.js', function (require) { -'use strict'; - -const components = { - ThreadViewer: require('mail/static/src/components/thread_viewer/thread_viewer.js'), -}; - -const { str_to_datetime } = require('web.time'); -const { patch } = require('web.utils'); - -patch(components.ThreadViewer, 'hr_holidays/static/src/components/thread_viewer/thread_viewer.js', { - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - /** - * Returns the "out of office" text for the correspondent of the thread if - * applicable. - * - * @returns {string} - */ - getOutOfOfficeText() { - if (!this.threadViewer.thread.correspondent) { - return ""; - } - if (!this.threadViewer.thread.correspondent.out_of_office_date_end) { - return ""; - } - const currentDate = new Date(); - const date = str_to_datetime(this.threadViewer.thread.correspondent.out_of_office_date_end); - const options = { day: 'numeric', month: 'short' }; - if (currentDate.getFullYear() !== date.getFullYear()) { - options.year = 'numeric'; - } - const formattedDate = date.toLocaleDateString(window.navigator.language, options); - return _.str.sprintf(this.env._t("Out of office until %s."), formattedDate); - }, - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - /** - * @override - */ - _useStoreSelector(props) { - const res = this._super(...arguments); - const threadViewer = this.env.models['mail.thread_viewer'].get(props.threadViewerLocalId); - const thread = threadViewer ? threadViewer.thread : undefined; - const correspondent = thread ? thread.correspondent : undefined; - return Object.assign({}, res, { - correspondent: correspondent ? correspondent.__state : undefined, - }); - }, -}); - -}); |
