Commit 7a2d6ce6 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic

Bug 1835321: Manager can't see peer block when published

WR#315075

Once the asessment is published by the author,
it'is supposed to be visible to everybody that
has access to the view

behatnotneeded

Change-Id: I116b665945a3d45fa2a14bb7654e55f561428368
parent 97f50e0c
...@@ -407,35 +407,19 @@ class ArtefactTypePeerassessment extends ArtefactType { ...@@ -407,35 +407,19 @@ class ArtefactTypePeerassessment extends ArtefactType {
else { else {
$where = 'pa.view = ? '; $where = 'pa.view = ? ';
// If the signoff block is also present on the page then we restrict things differently // select assessments that are published
$withsignoff = record_exists('block_instance', 'view', $viewid, 'blocktype', 'signoff'); // or select assessments where the user is the author, published or not
if ($withsignoff) { $where.= 'AND ( (pa.private = 0) ';
// If the view is signed off, select public assessments $where.= ' OR (a.author = ?))';
// or if viewing as page owner, select public assessments
// or if viewing as assessment author, select assessments owned by author
$where.= 'AND ((vsv.signoff = 1 AND pa.private = 0) ';
$where.= ' OR (a.author = ?)';
$where.= ' OR (pa.private = 0 AND a.owner = ?))';
$values = array($viewid, $userid, $userid, $block);
$joinsignoff = ' JOIN {view_signoff_verify} vsv ON vsv.view = pa.view ';
}
else {
// select assessments that are published
// or select assessments where the user is the author, published or not
$where.= 'AND ( (pa.private = 0) ';
$where.= ' OR (a.author = ?))';
$values = array($viewid, $userid, $block); $values = array($viewid, $userid, $block);
$joinsignoff = '';
}
$result->count = count_records_sql(' $result->count = count_records_sql('
SELECT COUNT(*) SELECT COUNT(*)
FROM FROM
{artefact} a {artefact} a
JOIN {artefact_peer_assessment} pa JOIN {artefact_peer_assessment} pa
ON a.id = pa.assessment' . $joinsignoff . ' ON a.id = pa.assessment
LEFT JOIN {artefact} p LEFT JOIN {artefact} p
ON a.parent = p.id ON a.parent = p.id
WHERE ' . $where . ' WHERE ' . $where . '
...@@ -460,7 +444,6 @@ class ArtefactTypePeerassessment extends ArtefactType { ...@@ -460,7 +444,6 @@ class ArtefactTypePeerassessment extends ArtefactType {
$ids = get_column_sql(' $ids = get_column_sql('
SELECT a.id SELECT a.id
FROM {artefact} a JOIN {artefact_peer_assessment} pa ON a.id = pa.assessment FROM {artefact} a JOIN {artefact_peer_assessment} pa ON a.id = pa.assessment
' . $joinsignoff . '
LEFT JOIN {artefact} p ON a.parent = p.id LEFT JOIN {artefact} p ON a.parent = p.id
WHERE ' . $where . ' WHERE ' . $where . '
AND pa.block = ? AND pa.block = ?
...@@ -491,7 +474,6 @@ class ArtefactTypePeerassessment extends ArtefactType { ...@@ -491,7 +474,6 @@ class ArtefactTypePeerassessment extends ArtefactType {
u.deleted, u.profileicon, u.urlid, p.id AS parent, p.author AS parentauthor u.deleted, u.profileicon, u.urlid, p.id AS parent, p.author AS parentauthor
FROM {artefact} a FROM {artefact} a
INNER JOIN {artefact_peer_assessment} pa ON a.id = pa.assessment INNER JOIN {artefact_peer_assessment} pa ON a.id = pa.assessment
' . $joinsignoff . '
LEFT JOIN {artefact} p LEFT JOIN {artefact} p
ON a.parent = p.id ON a.parent = p.id
LEFT JOIN {usr} u ON a.author = u.id LEFT JOIN {usr} u ON a.author = u.id
......
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