From d374ce27cfff973afef34059329e5bdd0ef96ae8 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 22 Jul 2023 12:45:21 +0100 Subject: [PATCH] Make package approval threads private We've found that a lot of users comment in these threads when they shouldn't --- app/blueprints/threads/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/blueprints/threads/__init__.py b/app/blueprints/threads/__init__.py index 35af39af..d7162dc3 100644 --- a/app/blueprints/threads/__init__.py +++ b/app/blueprints/threads/__init__.py @@ -265,7 +265,7 @@ def view(id): approvers = User.query.filter(User.rank >= UserRank.APPROVER).all() add_notification(approvers, current_user, NotificationType.EDITOR_MISC, msg, thread.get_view_url(), thread.package) - post_discord_webhook.delay(current_user.username, + post_discord_webhook.delay(current_user.display_name, "Replied to bot messages: {}".format(thread.get_view_url(absolute=True)), True) db.session.commit() @@ -297,8 +297,10 @@ def new(): if package is None and not current_user.rank.at_least(UserRank.APPROVER): abort(404) - allow_private_change = not package or package.approved is_review_thread = package and not package.approved + allow_private_change = not is_review_thread + if is_review_thread: + def_is_private = True # Check that user can make the thread if package and not package.check_perm(current_user, Permission.CREATE_THREAD): @@ -372,7 +374,7 @@ def new(): add_notification(approvers, current_user, NotificationType.EDITOR_MISC, notif_msg, thread.get_view_url(), package) if is_review_thread: - post_discord_webhook.delay(current_user.username, + post_discord_webhook.delay(current_user.display_name, "Opened approval thread: {}".format(thread.get_view_url(absolute=True)), True) db.session.commit()