[FIX] mail: chatter: various fixes
- Add recipients as followers, and automatically refresh the follower's list (before this rev., one needed to reload the record to see the followes' list updated) - Don't display needactions on chatter's messages - Simplify buttons of suggested partner's dialog, as it should only offer two possibilities: Save or Cancel - Replace unnecessary t-raw's by t-esc's
This commit is contained in:
@@ -140,6 +140,7 @@ function post_document_message (model_name, res_id, data) {
|
||||
attachment_ids: data.attachment_ids,
|
||||
body: _.str.trim(data.content),
|
||||
content_subtype: data.content_subtype,
|
||||
context: data.context,
|
||||
message_type: data.message_type,
|
||||
partner_ids: data.partner_ids,
|
||||
subtype: data.subtype,
|
||||
|
||||
@@ -505,7 +505,6 @@ var ChatterComposer = ChatComposer.extend({
|
||||
// update context
|
||||
message.context = _.defaults(self.context, {
|
||||
mail_post_autofollow: true,
|
||||
mail_post_autofollow_partner_ids: partner_ids,
|
||||
});
|
||||
def.resolve(message);
|
||||
});
|
||||
@@ -617,6 +616,7 @@ var ChatterComposer = ChatComposer.extend({
|
||||
default_email: parsed_email[1],
|
||||
},
|
||||
title: _t("Please complete partner's informations"),
|
||||
disable_multiple_selection: true,
|
||||
}).open();
|
||||
dialog.on('closed', self, function () {
|
||||
deferred.resolve();
|
||||
@@ -672,7 +672,6 @@ var ChatterComposer = ChatComposer.extend({
|
||||
default_partner_ids: partner_ids,
|
||||
default_is_log: self.options.is_log,
|
||||
mail_post_autofollow: true,
|
||||
mail_post_autofollow_partner_ids: partner_ids,
|
||||
};
|
||||
|
||||
if (self.context.default_model && self.context.default_res_id) {
|
||||
@@ -723,14 +722,15 @@ var Chatter = form_common.AbstractField.extend({
|
||||
var self = this;
|
||||
|
||||
// Move the follower's widget (if any) inside the chatter
|
||||
var followers = this.field_manager.fields.message_follower_ids;
|
||||
if (followers) {
|
||||
this.$('.o_chatter_topbar').append(followers.$el);
|
||||
this.followers = this.field_manager.fields.message_follower_ids;
|
||||
if (this.followers) {
|
||||
this.$('.o_chatter_topbar').append(this.followers.$el);
|
||||
}
|
||||
|
||||
this.thread = new ChatThread(this, {
|
||||
display_order: ChatThread.ORDER.DESC,
|
||||
display_document_link: false,
|
||||
display_needactions: false,
|
||||
});
|
||||
this.thread.on('load_more_messages', this, this.load_more_messages);
|
||||
this.thread.on('toggle_star_status', this, function (message_id) {
|
||||
@@ -759,6 +759,9 @@ var Chatter = form_common.AbstractField.extend({
|
||||
.post_message_in_document(this.model, this.res_id, message)
|
||||
.then(function () {
|
||||
self.close_composer();
|
||||
if (message.partner_ids.length) {
|
||||
self.refresh_followers(); // refresh followers' list
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
// todo: display notification
|
||||
@@ -823,6 +826,11 @@ var Chatter = form_common.AbstractField.extend({
|
||||
// fetch and render messages of current document
|
||||
return this.fetch_and_render_thread(this.msg_ids);
|
||||
},
|
||||
refresh_followers: function () {
|
||||
if (this.followers) {
|
||||
this.followers.read_value();
|
||||
}
|
||||
},
|
||||
// composer toggle
|
||||
on_open_composer_new_message: function () {
|
||||
this.open_composer();
|
||||
@@ -846,6 +854,7 @@ var Chatter = form_common.AbstractField.extend({
|
||||
old_composer.destroy();
|
||||
}
|
||||
self.composer.on('post_message', self, self.on_post_message);
|
||||
self.composer.on('need_refresh', self, self.refresh_followers);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<label>Activity</label>
|
||||
<select class="o_chatter_composer_subtype_select">
|
||||
<t t-foreach="widget.options.internal_subtypes" t-as="subtype">
|
||||
<option t-att-value="subtype['id']"><t t-raw="subtype['name']"/></option>
|
||||
<option t-att-value="subtype['id']"><t t-esc="subtype['name']"/></option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
@@ -30,7 +30,7 @@
|
||||
<span class="o_chatter_composer_info">
|
||||
To: Followers of
|
||||
<t t-if="widget.options.record_name">
|
||||
<t t-raw="'"' + widget.options.record_name + '"'"/>
|
||||
"<t t-esc="widget.options.record_name"/>"
|
||||
</t>
|
||||
<t t-if="!widget.options.record_name">
|
||||
this document
|
||||
@@ -157,7 +157,7 @@
|
||||
t-att-id="'input_mail_followers_subtype_'+record.id+(dialog ? '_in_dialog': '')"
|
||||
t-att-data-id="record.id" t-att-name="record.name" class="o_subtype_checkbox"/>
|
||||
<span t-att-for="'input_mail_followers_subtype_'+record.id+(dialog ? '_in_dialog': '')">
|
||||
<t t-raw="record.name"/>
|
||||
<t t-esc="record.name"/>
|
||||
</span>
|
||||
</li>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user