Commit c679c3b2 authored by Aaron Wells's avatar Aaron Wells
Browse files

Fixing bugs in the objectionable items refactor



Bug 1298646: No point in adding columns to the interaction_forum_post table
just to immediately drop them again.

Also, there were some lingering "accesstype IS NULL" checks in the elasticsearch
access queries, which should have been removed along with the "accesstype != objectionable"
that they were previously parenthetical with.

And, the artefact_access table doesn't need to accept "objectionable" as 
an accesstype enum value anymore.

Change-Id: I961f15e98eb8aab95e4e5b16af223eb61588f671
Signed-off-by: default avatarYuliya Bozhko <yuliya.bozhko@totaralms.com>
parent 7a7673c0
......@@ -128,15 +128,6 @@ function xmldb_interaction_forum_upgrade($oldversion=0) {
}
if ($oldversion < 2014050800) {
// Add new columns 'reported' and 'reportedreason' to table
// interaction_forum_post used for objectionable content reporting.
$table = new XMLDBTable('interaction_forum_post');
$field = new XMLDBField('reported');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
$field = new XMLDBField('reportedreason');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
// Subscribe admins to new activity.
$adminusers = get_column('usr', 'id', 'admin', 1, 'deleted', 0);
......
......@@ -512,7 +512,7 @@
<TABLE NAME="artefact_access">
<FIELDS>
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="accesstype" TYPE="char" LENGTH="16" NOTNULL="false" ENUM="true" ENUMVALUES="'public', 'loggedin', 'friends', 'objectionable'" />
<FIELD NAME="accesstype" TYPE="char" LENGTH="16" NOTNULL="false" ENUM="true" ENUMVALUES="'public', 'loggedin', 'friends'" />
<FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
......
......@@ -3423,7 +3423,7 @@ function xmldb_core_upgrade($oldversion=0) {
// Add artefact_access table.
$table = new XMLDBTable('artefact_access');
$table->addFieldInfo('artefact', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('accesstype', XMLDB_TYPE_CHAR, 16, null, null, null, XMLDB_ENUM, array('public', 'loggedin', 'friends', 'objectionable'));
$table->addFieldInfo('accesstype', XMLDB_TYPE_CHAR, 16, null, null, null, XMLDB_ENUM, array('public', 'loggedin', 'friends'));
$table->addFieldInfo('group', XMLDB_TYPE_INTEGER, 10);
$table->addFieldInfo('usr', XMLDB_TYPE_INTEGER, 10);
$table->addFieldInfo('institution', XMLDB_TYPE_CHAR, 255);
......
......@@ -358,7 +358,6 @@ class ElasticsearchType_artefact extends ElasticsearchType
WHERE vart.artefact = ?
AND (vac.startdate IS NULL OR vac.startdate < current_timestamp)
AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)
AND vac.accesstype IS NULL
UNION
SELECT vac.view AS view_id, vac.accesstype, vac.group, vac.role, vac.usr, vac.institution
FROM {artefact} art
......@@ -367,7 +366,6 @@ class ElasticsearchType_artefact extends ElasticsearchType
WHERE art.id = ?
AND (vac.startdate IS NULL OR vac.startdate < current_timestamp)
AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)
AND vac.accesstype IS NULL;
',
array($artefactid, $artefactid)
);
......
......@@ -205,8 +205,7 @@ class ElasticsearchType_collection extends ElasticsearchType
INNER JOIN {collection_view} vcol ON vac.view = vcol.view
WHERE vcol.collection = ?
AND (vac.startdate IS NULL OR vac.startdate < current_timestamp)
AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)
AND vac.accesstype IS NULL',
AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)',
array($id)
);
......
......@@ -201,8 +201,7 @@ class ElasticsearchType_view extends ElasticsearchType
FROM {view_access} va
WHERE va.view = ?
AND (startdate IS NULL OR startdate < current_timestamp)
AND (stopdate IS NULL OR stopdate > current_timestamp)
AND accesstype IS NULL',
AND (stopdate IS NULL OR stopdate > current_timestamp)',
array($viewid)
);
......
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