Commit 44b91057 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1845133: "Delete" button visible on timeline for comments"

parents 5ecf5336 9a009bb1
...@@ -74,7 +74,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype { ...@@ -74,7 +74,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype {
} }
// If the view has comments turned off, tutors can still leave // If the view has comments turned off, tutors can still leave
// comments if the view is submitted to their group. // comments if the view is submitted to their group.
if (!empty($releaseform) || ($view->user_comments_allowed($USER))) { if ((!empty($releaseform) || ($view->user_comments_allowed($USER))) && !$versioning) {
$addfeedbackpopup = true; $addfeedbackpopup = true;
} }
safe_require('artefact', 'comment'); safe_require('artefact', 'comment');
...@@ -82,6 +82,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype { ...@@ -82,6 +82,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype {
$commentoptions->limit = $limit; $commentoptions->limit = $limit;
$commentoptions->offset = $offset; $commentoptions->offset = $offset;
$commentoptions->showcomment = $showcomment; $commentoptions->showcomment = $showcomment;
$commentoptions->versioning = $versioning;
$commentoptions->view = $instance->get_view(); $commentoptions->view = $instance->get_view();
$feedback = ArtefactTypeComment::get_comments($commentoptions); $feedback = ArtefactTypeComment::get_comments($commentoptions);
$smarty = smarty_core(); $smarty = smarty_core();
......
...@@ -356,6 +356,7 @@ class ArtefactTypeComment extends ArtefactType { ...@@ -356,6 +356,7 @@ class ArtefactTypeComment extends ArtefactType {
$options->sort = (!empty($sortorder)) ? $sortorder : 'earliest'; $options->sort = (!empty($sortorder)) ? $sortorder : 'earliest';
$options->threaded = null; $options->threaded = null;
$options->blockid = null; $options->blockid = null;
$options->versioning = false;
return $options; return $options;
} }
...@@ -418,6 +419,7 @@ class ArtefactTypeComment extends ArtefactType { ...@@ -418,6 +419,7 @@ class ArtefactTypeComment extends ArtefactType {
'sort' => $sort, 'sort' => $sort,
'threaded' => $threaded, 'threaded' => $threaded,
'data' => array(), 'data' => array(),
'versioning' => $versioning,
); );
$where = 'c.hidden = 0'; $where = 'c.hidden = 0';
...@@ -785,7 +787,7 @@ class ArtefactTypeComment extends ArtefactType { ...@@ -785,7 +787,7 @@ class ArtefactTypeComment extends ArtefactType {
$is_export_preview = param_integer('export',0); $is_export_preview = param_integer('export',0);
// Comment authors can edit recent comments if they're private or if no one has replied yet. // Comment authors can edit recent comments if they're private or if no one has replied yet.
if (!$item->deletedby && $item->isauthor && !$is_export_preview if (!$item->deletedby && $item->isauthor && !$is_export_preview && !$data->versioning
&& ($item->private || $item->id == $lastcomment->id) && $item->ts > $editableafter) { && ($item->private || $item->id == $lastcomment->id) && $item->ts > $editableafter) {
$item->canedit = 1; $item->canedit = 1;
} }
...@@ -796,7 +798,7 @@ class ArtefactTypeComment extends ArtefactType { ...@@ -796,7 +798,7 @@ class ArtefactTypeComment extends ArtefactType {
if ($item->deletedby) { if ($item->deletedby) {
$item->deletedmessage = $deletedmessage[$item->deletedby]; $item->deletedmessage = $deletedmessage[$item->deletedby];
} }
else if (($candelete || $item->isauthor) && !$is_export_preview) { else if (($candelete || $item->isauthor) && !$is_export_preview && !$data->versioning) {
$check = get_record_sql('SELECT v.* FROM {view} v WHERE v.id = ?', array($data->view), ERROR_MULTIPLE); $check = get_record_sql('SELECT v.* FROM {view} v WHERE v.id = ?', array($data->view), ERROR_MULTIPLE);
if ($check->submittedstatus == View::UNSUBMITTED || if ($check->submittedstatus == View::UNSUBMITTED ||
......
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