Fixed visibility setting for replies to dm's. Closes #507

This commit is contained in:
Manuel Cortez 2023-01-29 16:12:37 -06:00
parent 3be01013f4
commit f87ced817f
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790

View File

@ -322,6 +322,9 @@ class BaseBuffer(base.Buffer):
else:
title = _("Reply to {}").format(item.account.username)
caption = _("Write your reply here")
# Set unlisted by default, so we will not clutter other user's buffers with replies.
# see https://github.com/MCV-Software/TWBlue/issues/504
visibility = "unlisted"
if item.reblog != None:
users = ["@{} ".format(user.acct) for user in item.reblog.mentions if user.id != self.session.db["user_id"]]
if item.reblog.account.acct != item.account.acct and "@{} ".format(item.reblog.account.acct) not in users:
@ -333,9 +336,7 @@ class BaseBuffer(base.Buffer):
users_str = "".join(users)
post = messages.post(session=self.session, title=title, caption=caption, text=users_str)
visibility_settings = dict(public=0, unlisted=1, private=2, direct=3)
# Set unlisted by default, so we will not clutter other user's buffers with replies.
# see https://github.com/MCV-Software/TWBlue/issues/504
post.message.visibility.SetSelection(visibility_settings.get("unlisted"))
post.message.visibility.SetSelection(visibility_settings.get(visibility))
# Respect content warning settings.
if item.sensitive:
post.message.sensitive.SetValue(item.sensitive)