From cefc6e945bd1a00d5adbb0ba8eadae73d4d1b015 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 12 Mar 2023 12:39:17 +0200 Subject: [PATCH] better messages to user when moving hole of post --- files/routes/reporting.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 4580328f0..da75e6f41 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -155,7 +155,13 @@ def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]: can_move_post = can_move_post or post.author_id == v.id if not can_move_post: return False - if sub_from == sub_to: abort(409, f"Post is already in /h/{sub_to}") + if sub_to == None: + sub_to_in_notif = 'the main feed' + else: + sub_to_in_notif = f'/h/{sub_to}' + + if sub_from == sub_to: abort(409, f"Post is already in {sub_to_in_notif}") + if post.author.exiled_from(sub_to): abort(403, f"User is exiled from this {HOLE_NAME}!") @@ -197,11 +203,6 @@ def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]: if v.admin_level >= PERMS['POST_COMMENT_MODERATION']: position = 'a site admin' else: position = f'a /h/{sub_from} mod' - if post.sub == None: - sub_to_in_notif = 'the main feed' - else: - sub_to_in_notif = f'/h/{post.sub}' - if sub_from == None: sub_from_in_notif = 'the main feed' else: @@ -212,4 +213,4 @@ def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]: cache.delete_memoized(frontlist) - return f"Post moved to /h/{post.sub}" + return f"Post moved to {sub_to_in_notif} successfully!"