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.')
|
||||
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
|
||||
def create(self, vals):
|
||||
if 'content' in vals and vals.get('forum_id'):
|
||||
|
@ -118,6 +118,7 @@ a.no-decoration {
|
||||
|
||||
.close.comment_delete {
|
||||
font-size: 16px;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.country_flag {
|
||||
|
@ -25,13 +25,14 @@ flectra.define('website_forum.website_forum', function (require) {
|
||||
if ($('a[href*="/login"]').length) {
|
||||
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>'+
|
||||
msg + '</div>');
|
||||
var vote_alert = $(ev.currentTarget).parent().find("#vote_alert");
|
||||
if (vote_alert.length === 0) {
|
||||
$(ev.currentTarget).parent().append($warning);
|
||||
var $voteAlert = $('#karma_alert');
|
||||
if ($voteAlert.length) {
|
||||
$voteAlert.remove();
|
||||
}
|
||||
$(ev.currentTarget).after($warning);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
<!-- helper -->
|
||||
<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()"/>
|
||||
<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>
|
||||
@ -1096,6 +1096,7 @@
|
||||
<t t-set="label"> </t>
|
||||
<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="form_classes" t-value="'pull-right'"/>
|
||||
</t>
|
||||
|
||||
<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="label">Convert as an answer</t>
|
||||
<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>
|
||||
<a t-attf-href="/forum/#{slug(forum)}/partner/#{message.author_id.id}"
|
||||
@ -1289,6 +1291,10 @@
|
||||
<!--Private profile-->
|
||||
<template id="private_profile">
|
||||
<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>
|
||||
<p>
|
||||
<a t-attf-href="/forum/#{slug(forum)}">Return to the question list.</a>
|
||||
|
Loading…
Reference in New Issue
Block a user