summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-02-04 13:27:22 +0100
committerChristophe Simonis <chs@odoo.com>2019-02-04 13:27:22 +0100
commit4400cce8201579fc9769b5e2d33829b43bce82d9 (patch)
treec507c7dca21bfb0c3bdca8ba57e63a6ab16f230c /addons/mail/static/src
parentceb05489303dee728c3960a87bf23795efc374c4 (diff)
parent4524ad06a8af82ab337fc5aa1d5aa8d8d3024923 (diff)
[MERGE] forward port branch saas-12.1 up to 4524ad06a8a
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/activity.js2
-rw-r--r--addons/mail/static/src/js/chatter.js7
-rw-r--r--addons/mail/static/src/js/composers/basic_composer.js5
-rw-r--r--addons/mail/static/src/js/services/mail_window_manager.js44
-rw-r--r--addons/mail/static/src/js/systray/systray_activity_menu.js5
-rw-r--r--addons/mail/static/src/js/thread_windows/thread_window.js6
-rw-r--r--addons/mail/static/src/scss/followers.scss2
7 files changed, 41 insertions, 30 deletions
diff --git a/addons/mail/static/src/js/activity.js b/addons/mail/static/src/js/activity.js
index 9543a7ebff2..a0cb23b940d 100644
--- a/addons/mail/static/src/js/activity.js
+++ b/addons/mail/static/src/js/activity.js
@@ -333,7 +333,7 @@ var BasicActivity = AbstractField.extend({
var self = this;
var $markDoneBtn = $(ev.currentTarget);
var activityID = $markDoneBtn.data('activity-id');
- var previousActivityTypeID = $markDoneBtn.data('previous-activity-type-id');
+ var previousActivityTypeID = $markDoneBtn.data('previous-activity-type-id') || false;
var forceNextActivity = $markDoneBtn.data('force-next-activity');
if ($markDoneBtn.data('toggle') == 'collapse') {
diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js
index da23521f65f..330e56b77b4 100644
--- a/addons/mail/static/src/js/chatter.js
+++ b/addons/mail/static/src/js/chatter.js
@@ -300,6 +300,7 @@ var Chatter = Widget.extend({
recordName: this.recordName,
defaultBody: oldComposer && oldComposer.$input && oldComposer.$input.val(),
defaultMentionSelections: oldComposer && oldComposer.getMentionListenerSelections(),
+ attachmentIds: (oldComposer && oldComposer.get('attachment_ids')) || [],
});
this._composer.on('input_focused', this, function () {
this._composer.mentionSetPrefetchedPartners(this._mentionSuggestions || []);
@@ -309,9 +310,7 @@ var Chatter = Widget.extend({
if (oldComposer) {
oldComposer.destroy();
}
- if (!config.device.isMobile) {
- self._composer.focus();
- }
+ self._composer.focus();
self._composer.on('post_message', self, function (messageData) {
self._discardOnReload(messageData).then(function () {
self._disableComposer();
@@ -321,7 +320,7 @@ var Chatter = Widget.extend({
self.trigger_up('reload');
} else if (messageData.attachment_ids.length) {
self._reloadAttachmentBox();
- self.trigger_up('reload', {fieldNames: ['message_attachment_count']});
+ self.trigger_up('reload', {fieldNames: ['message_attachment_count'], keepChanges: true});
}
}).fail(function () {
self._enableComposer();
diff --git a/addons/mail/static/src/js/composers/basic_composer.js b/addons/mail/static/src/js/composers/basic_composer.js
index b88d7f6b0d9..8a045ac2d82 100644
--- a/addons/mail/static/src/js/composers/basic_composer.js
+++ b/addons/mail/static/src/js/composers/basic_composer.js
@@ -26,7 +26,7 @@ var BasicComposer = Widget.extend({
'click .o_composer_button_add_attachment': '_onClickAddAttachment',
'click .o_composer_button_emoji': '_onEmojiButtonClick',
'focusout .o_composer_button_emoji': '_onEmojiButtonFocusout',
- 'click .o_mail_emoji_container .o_mail_emoji': '_onEmojiImageClick',
+ 'mousedown .o_mail_emoji_container .o_mail_emoji': '_onEmojiImageClick',
'focus .o_mail_emoji_container .o_mail_emoji': '_onEmojiImageFocus',
'dragover .o_file_drop_zone_container': '_onFileDragover',
'drop .o_file_drop_zone_container': '_onFileDrop',
@@ -58,7 +58,7 @@ var BasicComposer = Widget.extend({
// Attachments
this._attachmentDataSet = new data.DataSetSearch(this, 'ir.attachment', this.context);
this.fileuploadID = _.uniqueId('o_chat_fileupload');
- this.set('attachment_ids', []);
+ this.set('attachment_ids', options.attachmentIds || []);
// Mention
this._mentionManager = new MentionManager(this);
@@ -120,6 +120,7 @@ var BasicComposer = Widget.extend({
});
// Attachments
+ this._renderAttachments();
$(window).on(this.fileuploadID, this._onAttachmentLoaded.bind(this));
this.on('change:attachment_ids', this, this._renderAttachments);
diff --git a/addons/mail/static/src/js/services/mail_window_manager.js b/addons/mail/static/src/js/services/mail_window_manager.js
index c8e05957afb..4971e7f3f4b 100644
--- a/addons/mail/static/src/js/services/mail_window_manager.js
+++ b/addons/mail/static/src/js/services/mail_window_manager.js
@@ -101,31 +101,37 @@ MailManager.include({
// valid threadID, therefore no check
var thread = this.getThread(threadID);
var threadWindow = this._getThreadWindow(threadID);
+ var def = $.when();
if (!threadWindow) {
- threadWindow = this._makeNewThreadWindow(thread, options);
- this._placeNewThreadWindow(threadWindow, options.passively);
-
- threadWindow.appendTo($(this.THREAD_WINDOW_APPENDTO))
- .then(function () {
- self._repositionThreadWindows();
- return thread.fetchMessages();
- }).then(function () {
- threadWindow.render();
- threadWindow.scrollToBottom();
- if (
- !self._areAllThreadWindowsHidden() &&
- !thread.isFolded() &&
- !threadWindow.isPassive()
- ) {
- thread.markAsRead();
- }
- });
+ def = thread.fetchMessages().then(function () {
+ threadWindow = self._makeNewThreadWindow(thread, options);
+ self._placeNewThreadWindow(threadWindow, options.passively);
+ return threadWindow.appendTo($(self.THREAD_WINDOW_APPENDTO));
+ }).then(function () {
+ self._repositionThreadWindows();
+ threadWindow.render();
+ threadWindow.scrollToBottom();
+ if (
+ !self._areAllThreadWindowsHidden() &&
+ !thread.isFolded() &&
+ !threadWindow.isPassive()
+ ) {
+ thread.markAsRead();
+ }
+ }).fail(function () {
+ // thread window could not be open, which may happen due to
+ // access error while fetching messages to the document.
+ // abort opening the thread window in this case.
+ thread.close();
+ });
} else if (!options.passively) {
if (threadWindow.isHidden()) {
this._makeThreadWindowVisible(threadWindow);
}
}
- threadWindow.updateVisualFoldState();
+ def.then(function () {
+ threadWindow.updateVisualFoldState();
+ });
},
/**
* Called when a thread has its window state that has been changed, so its
diff --git a/addons/mail/static/src/js/systray/systray_activity_menu.js b/addons/mail/static/src/js/systray/systray_activity_menu.js
index c825844851e..593cac91506 100644
--- a/addons/mail/static/src/js/systray/systray_activity_menu.js
+++ b/addons/mail/static/src/js/systray/systray_activity_menu.js
@@ -46,7 +46,7 @@ var ActivityMenu = Widget.extend({
kwargs: {context: session.user_context},
}).then(function (data) {
self._activities = data;
- self.activityCounter = _.reduce(data, function (total_count, p_data) { return total_count + p_data.total_count; }, 0);
+ self.activityCounter = _.reduce(data, function (total_count, p_data) { return total_count + p_data.total_count || 0; }, 0);
self.$('.o_notification_counter').text(self.activityCounter);
self.$el.toggleClass('o_no_notification', !self.activityCounter);
});
@@ -118,7 +118,8 @@ var ActivityMenu = Widget.extend({
name: targetAction.data('model_name'),
views: [[false, 'activity'], [false, 'kanban'], [false, 'list']],
view_mode: 'activity',
- res_model: targetAction.data('res_model')
+ res_model: targetAction.data('res_model'),
+ context: { search_default_activities_my: true },
});
}
},
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 57907a55943..331228c91c8 100644
--- a/addons/mail/static/src/js/thread_windows/thread_window.js
+++ b/addons/mail/static/src/js/thread_windows/thread_window.js
@@ -280,8 +280,10 @@ var ThreadWindow = AbstractThreadWindow.extend({
clear_breadcrumbs: false,
active_id: this.hasThread() ? this._getThreadID() : undefined,
on_reverse_breadcrumb: function () {
- self.call('mail_service', 'getMailBus')
- .trigger('discuss_open', false);
+ var mailBus = self.call('mail_service', 'getMailBus');
+ if (mailBus) {
+ mailBus.trigger('discuss_open', false);
+ }
},
});
}
diff --git a/addons/mail/static/src/scss/followers.scss b/addons/mail/static/src/scss/followers.scss
index b2bbc77f7f2..934df9b7acc 100644
--- a/addons/mail/static/src/scss/followers.scss
+++ b/addons/mail/static/src/scss/followers.scss
@@ -84,6 +84,8 @@
.o_followers_list {
font-size: small;
+ max-height: 50vh; // ancestor has size 33px
+ overflow: auto;
.o_partner {
position: relative; // required for old design compatibility