Commit 22f2a1c1 authored by Son Nguyen's avatar Son Nguyen Committed by Robert Lyon
Browse files

Bug 1606509: Don't display links in anonymous comments

Treat anonymous user like a probationary user

behatnotneeded

Change-Id: I54238e0b0f33b6617ad61a042f06901d5defd06a
parent d42024a9
......@@ -98,7 +98,7 @@ function edit_annotation_feedback_validate(Pieform $form, $values) {
require_once(get_config('libroot.php') . 'antispam.php');
$result = probation_validate_content($values['message']);
if ($result !== true) {
$form->set_error('message', get_string('newuserscantpostlinksorimages'));
$form->set_error('message', get_string('newuserscantpostlinksorimages1'));
}
}
......
......@@ -1715,7 +1715,7 @@ function add_annotation_feedback_form_validate(Pieform $form, $values) {
$result = probation_validate_content($values['message']);
if ($result !== true) {
$form->set_error('message', get_string('newuserscantpostlinksorimages'));
$form->set_error('message', get_string('newuserscantpostlinksorimages1'));
}
}
......
......@@ -96,7 +96,7 @@ function edit_comment_validate(Pieform $form, $values) {
require_once(get_config('libroot.php') . 'antispam.php');
$result = probation_validate_content($values['message']);
if ($result !== true) {
$form->set_error('message', get_string('newuserscantpostlinksorimages'));
$form->set_error('message', get_string('newuserscantpostlinksorimages1'));
}
}
......
......@@ -1511,7 +1511,7 @@ function add_feedback_form_validate(Pieform $form, $values) {
}
$result = probation_validate_content($values['message']);
if ($result !== true) {
$form->set_error('message', get_string('newuserscantpostlinksorimages'));
$form->set_error('message', get_string('newuserscantpostlinksorimages1'));
}
if ($values['replyto']) {
$parent = get_record_sql(
......
......@@ -219,7 +219,7 @@ EOF;
require_once(get_config('libroot') . 'antispam.php');
$result = probation_validate_content($values['text']);
if ($result !== true) {
$form->set_error('text', get_string('newuserscantpostlinksorimages'));
$form->set_error('text', get_string('newuserscantpostlinksorimages1'));
}
}
......
......@@ -178,7 +178,7 @@ function editpost_validate(Pieform $form, $values) {
}
$result = probation_validate_content($values['body']);
if ($result !== true) {
$form->set_error('body', get_string('newuserscantpostlinksorimages'));
$form->set_error('body', get_string('newuserscantpostlinksorimages1'));
}
}
......
......@@ -178,7 +178,7 @@ function addtopic_validate(Pieform $form, $values) {
}
$result = probation_validate_content($values['body']);
if ($result !== true) {
$form->set_error('body', get_string('newuserscantpostlinksorimages'));
$form->set_error('body', get_string('newuserscantpostlinksorimages1'));
}
}
......@@ -188,7 +188,7 @@ function edittopic_validate(Pieform $form, $values) {
}
$result = probation_validate_content($values['body']);
if ($result !== true) {
$form->set_error('body', get_string('newuserscantpostlinksorimages'));
$form->set_error('body', get_string('newuserscantpostlinksorimages1'));
}
}
......
......@@ -746,7 +746,7 @@ $string['spamtrap'] = 'Spam trap';
$string['formerror'] = 'There was an error processing your submission. Please try again.';
$string['formerroremail'] = 'Contact us at %s if you continue to have problems.';
$string['blacklisteddomaininurl'] = 'A URL in this field contains the blacklisted domain %s.';
$string['newuserscantpostlinksorimages'] = 'Sorry, newly registered users aren\'t allowed to post links. Please reword your post to remove any links or URLs and try again.';
$string['newuserscantpostlinksorimages1'] = 'Sorry, anonymous or newly registered users aren\'t allowed to post links. Please reword your post to remove any links or URLs and try again.';
$string['notinstallable'] = 'Not installable';
$string['installedplugins'] = 'Installed plugins';
......
......@@ -91,9 +91,11 @@ function is_probationary_user($user = null) {
}
// We actually store new user points in reverse. When your account is created, you get $newuserthreshold points, and
// we decrease those when you do something good, and when it hits 0 you're no longer a new user.
$userspoints = get_field('usr', 'probation', 'id', $user->get('id'));
if ($userspoints > 0) {
// we decrease those when you do something good, and when it hits 0 you're no longer a new user
// we also want to treat anonymous users as always in probation.
$userid = $user->get('id');
$userspoints = get_field('usr', 'probation', 'id', $userid);
if (empty($userid) || $userspoints > 0) {
return true;
}
else {
......
......@@ -63,7 +63,11 @@
{$item->deletedmessage}
</span>
{else}
{$item->description|safe|clean_html}
{if $item->author}
{$item->description|safe|clean_html}
{else}
{$item->description|safe}
{/if}
{/if}
</div>
......
......@@ -124,7 +124,13 @@
</a>{/if}
{/if}
</p>
<p>{$item->message|safe}</p>
<p>
{if ($item->fromusr != 0)}
{$item->message|safe|clean_html}
{else}
{$item->message|safe}
{/if}
</p>
{if $item->url}
<a class="action" href="{$WWWROOT}{$item->url}">
{if $item->urltext}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment