Skip to content

Commit

Permalink
Add flash message in case a comment report url is used that doesn't b…
Browse files Browse the repository at this point in the history
…elong to the user. Add redirect to member's comment page as well.
  • Loading branch information
thisismeonmounteverest committed Dec 23, 2023
1 parent 2404eca commit d6bf411
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Controller/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public function reportCommentAction(
$member = $this->getUser();

if ($member !== $toMember) {
throw new AccessDeniedException();
$this->addTranslatedFlash('notice', 'flash.comment.report.only.own');

return $this->redirectToRoute('profile_comments', ['username' => $member->getUsername()]);
}

$commentRepository = $entityManager->getRepository(Comment::class);
Expand Down
3 changes: 3 additions & 0 deletions translations/missing/comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ comment.reminder.host.body:
<p>We hope your experience was pleasant and enriching, and that your comment will help other members experience the same. But in case there were serious problems, please do share them, too. You can also share information confidentially with the Safety Team using the “Report profile” link on the profile of {profile_start}{host}{profile_end}.</p>
<p>The BeWelcome volunteers.</p>"
- Text of the comment reminder send to the host if the guest doesn't leave a comment (send three weeks after the end of the requested stay). Pay special attention to the start and end variables for the links.
flash.comment.report.only.own:
- Can't report comments of other members.
- Flash message shown if you followed a wrong link to report a comment.

0 comments on commit d6bf411

Please sign in to comment.