Skip to content

Commit 11da0fd

Browse files
committed
[FIX] website_event_exhibitor: de-traw-ify
Remove t-raw and mark website_description as markup-safe right after fetching it. Also update `_fetchSponsor` to use async/await, and remove seemingly unnecessary empty div in template, and convert `<span>` to `<div>` as the contents is arbitrary and thus could be a block.
1 parent 8462945 commit 11da0fd

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

addons/website_event_exhibitor/static/src/js/event_exhibitor_connect.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ odoo.define('website_event_exhibitor.event_exhibitor_connect', function (require
33

44
var Dialog = require('web.Dialog');
55
var publicWidget = require('web.public.widget');
6+
const {Markup} = require('web.utils');
67

78
var ExhibitorConnectClosedDialog = Dialog.extend({
89
events: _.extend({}, Dialog.prototype.events, {
@@ -44,18 +45,13 @@ var ExhibitorConnectClosedDialog = Dialog.extend({
4445

4546
/**
4647
* @private
47-
* @returns {Promise<*>} promise after fetching sponsor data, given its
48-
* sponsorId. Necessary to render template content;
4948
*/
50-
_fetchSponsor: function () {
51-
let self = this;
52-
let rpcPromise = this._rpc({
53-
route: `/event_sponsor/${this.sponsorId}/read`,
54-
}).then(function (readData) {
55-
self.sponsorData = readData;
56-
return Promise.resolve();
49+
async _fetchSponsor() {
50+
const sponsorData = await this._rpc({
51+
route: `/event_sponsor/${this.sponsorId}/read`
5752
});
58-
return rpcPromise;
53+
sponsorData.website_description = Markup(sponsorData.website_description);
54+
this.sponsorData = sponsorData;
5955
},
6056
});
6157

addons/website_event_exhibitor/static/src/xml/event_exhibitor_connect.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@
6767
t-att-alt="widget.sponsorData.country_name"/>
6868
</div>
6969
</div>
70-
<span class="col-12" t-if="widget.sponsorData.website_description" t-raw="widget.sponsorData.website_description"/>
71-
</div>
72-
<div>
70+
<div class="col-12" t-if="widget.sponsorData.website_description" t-out="widget.sponsorData.website_description"/>
7371
</div>
7472
</div>
7573
</t>

0 commit comments

Comments
 (0)