summaryrefslogtreecommitdiff
path: root/addons/website_forum/static/src/js/website_forum.share.js
diff options
context:
space:
mode:
authorPriyanka Kakadiya <pka@odoo.com>2019-09-27 10:42:34 +0000
committerJeremy Kersten <jke@odoo.com>2020-02-03 09:07:14 +0000
commit3ec0b4190376b4a5233abb93dfd0ca101746cc76 (patch)
tree9921e66068143aa65fdac20bae510b299b4688e8 /addons/website_forum/static/src/js/website_forum.share.js
parent465b79829c9c6cb0f43891ce67190e5c6fc55fc6 (diff)
[IMP] website_forum: show share buttons only on validated question
Before this commit: when a user asks a question on a forum, share buttons are always showing even if question is validated or not and hence it will lead to 404 error. After this commit: when a user asks a question on a forum, share buttons will only show after a question is validated. task-2064874 closes odoo/odoo#37505 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website_forum/static/src/js/website_forum.share.js')
-rw-r--r--addons/website_forum/static/src/js/website_forum.share.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/website_forum/static/src/js/website_forum.share.js b/addons/website_forum/static/src/js/website_forum.share.js
index f849fe7ada4..0545d775a81 100644
--- a/addons/website_forum/static/src/js/website_forum.share.js
+++ b/addons/website_forum/static/src/js/website_forum.share.js
@@ -47,12 +47,17 @@ var ForumShare = publicWidget.registry.socialShare.extend({
* @private
*/
_render: function () {
+ var $question = this.$('article.question');
if (!this.targetType) {
this._super.apply(this, arguments);
} else if (this.targetType === 'social-alert') {
- $('.row .question').before(qweb.render('website.social_alert', {medias: this.socialList}));
+ $question.before(qweb.render('website.social_alert', {medias: this.socialList}));
} else {
- $('body').append(qweb.render('website.social_modal', {medias: this.socialList, target_type: this.targetType}));
+ $('body').append(qweb.render('website.social_modal', {
+ medias: this.socialList,
+ target_type: this.targetType,
+ state: $question.data('state'),
+ }));
$('#oe_social_share_modal').modal('show');
}
},