Commit 6f3b2509 by Robert Lyon Committed by Aaron Wells

Bug 1603206: Anonymous comments set watchlist for root user

When an anonymous comment was left it would set up a watchlist for the view to sent to root user (user id = 0) This patch stps that happening and removes any existing rows in usr_watchlist_view for usr = 0 behatnotneeded Change-Id: I8a560ac778359d2f4c398a318c7abac3573bb348 Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent b4af5ddc
......@@ -1624,10 +1624,10 @@ function add_feedback_form_submit(Pieform $form, $values) {
);
// We want to add the user placing the comment to the watchlist so they
// can get notified about future comments to the page.
// can get notified about future comments to the page, unless they are anonymous.
// @TODO Add a site/institution preference to override this.
$updatelink = false;
if (!get_field('usr_watchlist_view', 'ctime', 'usr', $author, 'view', $view->get('id')) && ($author != $owner)) {
if (!$anonymous && !get_field('usr_watchlist_view', 'ctime', 'usr', $author, 'view', $view->get('id')) && ($author != $owner)) {
insert_record('usr_watchlist_view', (object) array('usr' => $author,
'view' => $view->get('id'),
'ctime' => db_format_timestamp(time())));
......
......@@ -4343,5 +4343,10 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2015092932) {
log_debug('Removing any watchlist items for root user as they are not needed');
delete_records('usr_watchlist_view', 'usr', 0);
}
return $status;
}
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2015092931;
$config->version = 2015092932;
$config->series = '15.10';
$config->release = '15.10.7testing';
$config->minupgradefrom = 2012080604;
......
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