From 9af914db8540e8d91f68786e924844e5e86b0639 Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Mon, 28 Oct 2019 18:12:20 -0400 Subject: [PATCH] Visibility of replies now more restrictive by default Formerly, the visibility of replies defaulted to the visibility of the post they were in reply to. Now they default to the more restrictive of the visibility of the post they were in reply to, or your account's default visibility. This should be less surprising for people with more restrictive default visibility settings. --- brutaldon/views.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/brutaldon/views.py b/brutaldon/views.py index cbe3eb7..eb6d034 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -37,6 +37,8 @@ class NotLoggedInException(Exception): global sessons_cache sessions_cache = {} +VISIBILITIES = ["direct", "private", "unlisted", "public"] + ### ### Utility functions ### @@ -164,6 +166,12 @@ def user_search_inner(request, query): ) +def min_visibility(visibility1, visibility2): + return VISIBILITIES[ + min(VISIBILITIES.index(visibility1), VISIBILITIES.index(visibility2)) + ] + + def timeline( request, timeline="home", @@ -1012,7 +1020,9 @@ def reply(request, id): form = PostForm( initial={ "status": initial_text, - "visibility": toot.visibility, + "visibility": min_visibility( + toot.visibility, request.session["active_user"].source.privacy + ), "spoiler_text": toot.spoiler_text, } )