[FIX] portal: dynamic chatter not editable

60c920d4a should solve duplication of chatter when editing the website.

But portal module doesn't depends on website, so eg. on a instance with
just helpdesk (and no website) we would not see the chatter on the
frontend.

This fix reverts 60c920d4a and adds another solution not depending on
website.

opw-1813792
closes #23614
This commit is contained in:
Nicolas Lempereur
2018-03-13 15:41:59 +01:00
parent 669c23d58d
commit c2f910717a
2 changed files with 7 additions and 15 deletions
+6 -14
View File
@@ -5,7 +5,6 @@ var base = require('web_editor.base');
var ajax = require('web.ajax');
var core = require('web.core');
var Widget = require('web.Widget');
var sAnimation = require('website.content.snippets.animation');
var rpc = require('web.rpc');
var time = require('web.time');
@@ -223,19 +222,12 @@ var PortalChatter = Widget.extend({
},
});
sAnimation.registry.portal_chatter = sAnimation.Class.extend({
selector: ".o_portal_chatter",
destroy: function () {
this.$target.empty();
return this._super.apply(this, arguments);
},
start: function () {
if (!this.editableMode) {
var mail_thread = new PortalChatter(null, this.$el.data());
mail_thread.appendTo(this.$el);
}
return this._super.apply(this, arguments);
},
base.ready().then(function () {
$('.o_portal_chatter').each(function (index) {
var $elem = $(this);
var mail_thread = new PortalChatter(null, $elem.data());
mail_thread.appendTo($elem);
});
});
return {
+1 -1
View File
@@ -349,7 +349,7 @@
the message will be posted with the identity of the partner_id of the object
-->
<template id="message_thread">
<div id="discussion" class="hidden-print o_portal_chatter"
<div id="discussion" class="hidden-print o_portal_chatter o_not_editable"
t-att-data-token="token" t-att-data-res_model="object._name" t-att-data-res_id="object.id" t-att-data-pager_step="message_per_page or 10" t-att-data-allow_composer="'0' if disable_composer else '1'">
</div>
</template>