[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>
This commit is contained in:
committed by
Jeremy Kersten
parent
465b79829c
commit
3ec0b41903
@@ -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');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<t t-if="target_type == 'question'" t-call="website_forum.social_message_question"/>
|
||||
<t t-if="target_type == 'answer'" t-call="website_forum.social_message_answer"/>
|
||||
<t t-if="target_type == 'default'" t-call="website_forum.social_message_default"/>
|
||||
<div class="share-icons text-center text-primary">
|
||||
<div t-if="state != 'pending'" class="share-icons text-center text-primary">
|
||||
<t t-foreach="medias" t-as="media">
|
||||
<a style="cursor: pointer" t-attf-class="fa-stack fa-lg share #{media}" t-attf-aria-label="Share on #{media}" t-attf-title="Share on #{media}">
|
||||
<span class="fa fa-square fa-stack-2x"></span>
|
||||
@@ -45,6 +45,7 @@
|
||||
<p>On average, <b>45% of questions shared</b> on social networks get an answer within
|
||||
5 hours. Questions shared on two social networks have <b>65% more chance to get an
|
||||
answer</b> !</p>
|
||||
<p t-if="state == 'pending'">You can share your question once it has been validated</p>
|
||||
</t>
|
||||
<t t-name="website_forum.social_message_answer">
|
||||
<p>By sharing you answer, you will get additional <b>karma points</b> if your
|
||||
|
||||
@@ -988,7 +988,8 @@
|
||||
<article t-attf-class="question o_wforum_post row no-gutters #{can_bump and 'oe_js_bump'}"
|
||||
data-type="question"
|
||||
t-att-data-last-update="question.write_date"
|
||||
t-att-data-id="question.id">
|
||||
t-att-data-id="question.id"
|
||||
t-att-data-state="question.state">
|
||||
|
||||
<div t-if="question.state == 'active'" class="col-6 mb-3 col-md-auto pr-2 pr-md-3 pr-lg-4">
|
||||
<t t-call="website_forum.vote">
|
||||
|
||||
Reference in New Issue
Block a user