From c8fdf7c205afbe4064dbc5d8addd7b8fb668afe6 Mon Sep 17 00:00:00 2001 From: Hendrik L Date: Mon, 13 Jan 2025 18:12:35 +0100 Subject: [PATCH] show who deleted a post --- app/post/routes.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/post/routes.py b/app/post/routes.py index bf0a19b9..b25acc21 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -44,7 +44,10 @@ def show_post(post_id: int): if current_user.is_anonymous or not (current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff())): abort(404) else: - flash(_('This post has been deleted and is only visible to staff and admins.'), 'warning') + if post.deleted_by == post.user_id: + flash(_('This post has been deleted by the author and is only visible to staff and admins.'), 'warning') + else: + flash(_('This post has been deleted and is only visible to staff and admins.'), 'warning') sort = request.args.get('sort', 'hot') @@ -390,7 +393,10 @@ def continue_discussion(post_id, comment_id): if current_user.is_anonymous or not (current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff())): abort(404) else: - flash(_('This comment has been deleted and is only visible to staff and admins.'), 'warning') + if post.deleted_by == post.user_id: + flash(_('This post has been deleted by the author and is only visible to staff and admins.'), 'warning') + else: + flash(_('This post has been deleted and is only visible to staff and admins.'), 'warning') mods = post.community.moderators() is_moderator = current_user.is_authenticated and any(mod.user_id == current_user.id for mod in mods)