Commit 9a009bb1 authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon

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

- added in versioning var to get_comment_options func
and changed deleteform display logic in build_html func

behatnotneeded

Change-Id: Id9ed39ad8d1d8cf58f4351b5bca857442a6490bd
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 7cc60855
......@@ -74,7 +74,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype {
}
// If the view has comments turned off, tutors can still leave
// 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;
}
safe_require('artefact', 'comment');
......@@ -82,6 +82,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype {
$commentoptions->limit = $limit;
$commentoptions->offset = $offset;
$commentoptions->showcomment = $showcomment;
$commentoptions->versioning = $versioning;
$commentoptions->view = $instance->get_view();
$feedback = ArtefactTypeComment::get_comments($commentoptions);
$smarty = smarty_core();
......
......@@ -356,6 +356,7 @@ class ArtefactTypeComment extends ArtefactType {
$options->sort = (!empty($sortorder)) ? $sortorder : 'earliest';
$options->threaded = null;
$options->blockid = null;
$options->versioning = false;
return $options;
}
......@@ -418,6 +419,7 @@ class ArtefactTypeComment extends ArtefactType {
'sort' => $sort,
'threaded' => $threaded,
'data' => array(),
'versioning' => $versioning,
);
$where = 'c.hidden = 0';
......@@ -785,7 +787,7 @@ class ArtefactTypeComment extends ArtefactType {
$is_export_preview = param_integer('export',0);
// 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->canedit = 1;
}
......@@ -796,7 +798,7 @@ class ArtefactTypeComment extends ArtefactType {
if ($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);
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