[FIX] website_forum: restore karma guidelines link in notifications
The link was added as text instead of HTML since the notification/t-raw refactoring. task-2601633 closes odoo/odoo#74276 X-original-commit: 3b5b460f20295983582946bfd841211884456cc5 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
committed by
qsm-odoo
co-authored by
qsm-odoo
parent
67dac2ad3a
commit
a7d5bb1035
@@ -230,28 +230,35 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({
|
||||
* @param {Event} ev
|
||||
*/
|
||||
_onKarmaRequiredClick: function (ev) {
|
||||
var $karma = $(ev.currentTarget);
|
||||
var karma = $karma.data('karma');
|
||||
var forum_id = $('#wrapwrap').data('forum_id');
|
||||
const karma = parseInt(ev.currentTarget.dataset.karma);
|
||||
if (!karma) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.preventDefault();
|
||||
var msg = karma + ' ' + _t("karma is required to perform this action. ");
|
||||
var title = _t("Karma Error");
|
||||
if (forum_id) {
|
||||
msg += '<a class="alert-link" href="/forum/' + forum_id + '/faq">' + _t("Read the guidelines to know how to gain karma.") + '</a>';
|
||||
}
|
||||
if (session.is_website_user) {
|
||||
msg = _t("Sorry you must be logged in to perform this action");
|
||||
title = _t("Access Denied");
|
||||
}
|
||||
this.displayNotification({
|
||||
message: msg,
|
||||
title: title,
|
||||
sticky: false,
|
||||
const forumID = parseInt(document.getElementById('wrapwrap').dataset.forum_id);
|
||||
const notifOptions = {
|
||||
type: "warning",
|
||||
});
|
||||
sticky: false,
|
||||
};
|
||||
if (session.is_website_user) {
|
||||
notifOptions.title = _t("Access Denied");
|
||||
notifOptions.message = _t("Sorry you must be logged in to perform this action");
|
||||
} else {
|
||||
notifOptions.title = _t("Karma Error");
|
||||
// FIXME this translation is bad, the number should be part of the
|
||||
// translation, to fix in the appropriate version
|
||||
notifOptions.message = `${karma} ${_t("karma is required to perform this action. ")}`;
|
||||
if (forumID) {
|
||||
notifOptions.messageIsHtml = true;
|
||||
const linkLabel = _.escape(_t("Read the guidelines to know how to gain karma."));
|
||||
notifOptions.message = `
|
||||
${_.escape(notifOptions.message)}<br/>
|
||||
<a class="alert-link" href="/forum/${forumID}/faq">${linkLabel}</a>
|
||||
`;
|
||||
}
|
||||
}
|
||||
this.displayNotification(notifOptions);
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user