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.
This commit is contained in:
Jason McBrayer 2019-10-28 18:12:20 -04:00
parent be78053179
commit 9af914db85

View File

@ -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,
}
)