Skip to content

Commit ee51b7c

Browse files
Show comment update on profile page and set ADMIN_CHECK for negative comments.
1 parent 6d620c3 commit ee51b7c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

build/members/templates/profile.subcolumn_right.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ function wasGuestOrHost(string $relations) {
168168
<a href="/members/<?= $this->member->Username;?>/comment/<?php echo $comment->id;?>/report" title="<?=$words->getSilent('ReportCommentProblem') ?>"
169169
class="float-left gray align-self-center"><i class="fa fa-flag" alt="<?=$words->getSilent('ReportCommentProblem') ?>"></i></a>
170170
<?php } ?>
171-
<?php }?>
171+
<?php }
172+
if (null !== $comment->updated && $comment->created !== $comment->updated){ ?>
173+
<p class="small"><?=$words->get('CommentLastUpdated')?>: <span title="<?= $comment->updated; ?>"><?= (new Carbon($comment->updated))->diffForHumans(); ?></span></p>
174+
<?php } ?>
172175
</div>
173176
</div>
174177
</div>
@@ -239,6 +242,9 @@ class="align-self-center float-right"><button class="o-button"><?= $addCommentTr
239242
<?php if ($loggedIn === $comment->UsernameToMember) { ?>
240243
<a href="/members/<?= $this->member->Username;?>/comment/<?php echo $comment->id;?>/report" title="<?=$words->getSilent('ReportCommentProblem') ?>" class="float-right gray align-self-center">
241244
<i class="fa fa-flag" alt="<?=$words->getSilent('ReportCommentProblem') ?>"></i></a>
245+
<?php }
246+
if (null !== $comment->updated && $comment->created !== $comment->updated){ ?>
247+
<p class="small"><?=$words->get('CommentLastUpdated')?>: <span title="<?= $comment->updated; ?>"><?= (new Carbon($comment->updated))->diffForHumans(); ?></span></p>
242248
<?php } ?>
243249
</div>
244250
</div>

src/Controller/CommentController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ public function addComment(
149149
$comment = $form->getData();
150150
$comment->setToMember($member);
151151
$comment->setFromMember($loggedInMember);
152+
if (CommentQualityType::NEGATIVE === $comment->getQuality()) {
153+
$comment->setAdminAction(CommentAdminActionType::ADMIN_CHECK);
154+
}
152155
$entityManager->persist($comment);
153156

154157
// Mark comment guidelines as read and hide the checkbox for the future
@@ -201,7 +204,7 @@ public function editComment(
201204
}
202205

203206
if ($comment->getQuality() == CommentQualityType::NEGATIVE && !$comment->getEditingAllowed()) {
204-
$this->addTranslatedFlash('comment.editing.not.allowed', []);
207+
$this->addTranslatedFlash('notice', 'comment.editing.not.allowed', []);
205208

206209
return $this->redirectToRoute('members_profile', ['username' => $member->getUsername()]);
207210
}
@@ -236,6 +239,10 @@ public function editComment(
236239
$comment->setUpdated(new DateTime());
237240
}
238241

242+
if (CommentQualityType::NEGATIVE === $comment->getQuality()) {
243+
$comment->setAdminAction(CommentAdminActionType::ADMIN_CHECK);
244+
}
245+
239246
$entityManager->persist($comment);
240247
$entityManager->flush();
241248

0 commit comments

Comments
 (0)