Added Upstream Patch for website_forum
This commit is contained in:
parent
de11d52ad4
commit
3712c502ce
@ -434,6 +434,11 @@ class Post(models.Model):
|
|||||||
raise KarmaError('User karma not sufficient to post an image or link.')
|
raise KarmaError('User karma not sufficient to post an image or link.')
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
@api.constrains('parent_id')
|
||||||
|
def _check_parent_id(self):
|
||||||
|
if not self._check_recursion():
|
||||||
|
raise ValidationError(_('You cannot create recursive forum posts.'))
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
if 'content' in vals and vals.get('forum_id'):
|
if 'content' in vals and vals.get('forum_id'):
|
||||||
|
@ -118,6 +118,7 @@ a.no-decoration {
|
|||||||
|
|
||||||
.close.comment_delete {
|
.close.comment_delete {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
float: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.country_flag {
|
.country_flag {
|
||||||
|
@ -25,13 +25,14 @@ flectra.define('website_forum.website_forum', function (require) {
|
|||||||
if ($('a[href*="/login"]').length) {
|
if ($('a[href*="/login"]').length) {
|
||||||
msg = _t('Sorry you must be logged in to perform this action');
|
msg = _t('Sorry you must be logged in to perform this action');
|
||||||
}
|
}
|
||||||
var $warning = $('<div class="alert alert-danger alert-dismissable oe_forum_alert" id="karma_alert">'+
|
var $warning = $('<div class="alert alert-danger alert-dismissable oe_forum_alert mt8" id="karma_alert">'+
|
||||||
'<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">×</button>'+
|
'<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">×</button>'+
|
||||||
msg + '</div>');
|
msg + '</div>');
|
||||||
var vote_alert = $(ev.currentTarget).parent().find("#vote_alert");
|
var $voteAlert = $('#karma_alert');
|
||||||
if (vote_alert.length === 0) {
|
if ($voteAlert.length) {
|
||||||
$(ev.currentTarget).parent().append($warning);
|
$voteAlert.remove();
|
||||||
}
|
}
|
||||||
|
$(ev.currentTarget).after($warning);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<!-- helper -->
|
<!-- helper -->
|
||||||
<template id="link_button">
|
<template id="link_button">
|
||||||
<form method="POST" t-att-action="url">
|
<form method="POST" t-att-action="url" t-attf-class="#{form_classes}">
|
||||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||||
<button t-attf-class="fa btn-link #{classes} #{karma and 'karma_required text-muted' or ''}" t-attf-data-karma="#{karma}">
|
<button t-attf-class="fa btn-link #{classes} #{karma and 'karma_required text-muted' or ''}" t-attf-data-karma="#{karma}">
|
||||||
<t t-esc="label"/></button>
|
<t t-esc="label"/></button>
|
||||||
@ -1096,6 +1096,7 @@
|
|||||||
<t t-set="label"> </t>
|
<t t-set="label"> </t>
|
||||||
<t t-set="karma" t-value="user.karma<required_karma and required_karma or 0"/>
|
<t t-set="karma" t-value="user.karma<required_karma and required_karma or 0"/>
|
||||||
<t t-set="classes" t-value="'close comment_delete fa-times'"/>
|
<t t-set="classes" t-value="'close comment_delete fa-times'"/>
|
||||||
|
<t t-set="form_classes" t-value="'pull-right'"/>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<div><span t-field="message.body" class="oe_no_empty"/></div>
|
<div><span t-field="message.body" class="oe_no_empty"/></div>
|
||||||
@ -1108,7 +1109,8 @@
|
|||||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/convert_to_answer'"/>
|
<t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/convert_to_answer'"/>
|
||||||
<t t-set="label">Convert as an answer</t>
|
<t t-set="label">Convert as an answer</t>
|
||||||
<t t-set="karma" t-value="user.karma<required_karma and required_karma or 0"/>
|
<t t-set="karma" t-value="user.karma<required_karma and required_karma or 0"/>
|
||||||
<t t-set="classes" t-value="'fa-magic pull-right'"/>
|
<t t-set="classes" t-value="'fa-magic'"/>
|
||||||
|
<t t-set="form_classes" t-value="'pull-right'"/>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
<a t-attf-href="/forum/#{slug(forum)}/partner/#{message.author_id.id}"
|
<a t-attf-href="/forum/#{slug(forum)}/partner/#{message.author_id.id}"
|
||||||
@ -1289,6 +1291,10 @@
|
|||||||
<!--Private profile-->
|
<!--Private profile-->
|
||||||
<template id="private_profile">
|
<template id="private_profile">
|
||||||
<t t-call="website_forum.header">
|
<t t-call="website_forum.header">
|
||||||
|
<t t-set='head'>
|
||||||
|
<t t-raw='head'/>
|
||||||
|
<meta name="robots" content="noindex follow"/>
|
||||||
|
</t>
|
||||||
<h1 class="mt32">This profile is private!</h1>
|
<h1 class="mt32">This profile is private!</h1>
|
||||||
<p>
|
<p>
|
||||||
<a t-attf-href="/forum/#{slug(forum)}">Return to the question list.</a>
|
<a t-attf-href="/forum/#{slug(forum)}">Return to the question list.</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user