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: else:
title = _("Reply to {}").format(item.account.username) title = _("Reply to {}").format(item.account.username)
caption = _("Write your reply here") 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: if item.reblog != None:
users = ["@{} ".format(user.acct) for user in item.reblog.mentions if user.id != self.session.db["user_id"]] 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: 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) users_str = "".join(users)
post = messages.post(session=self.session, title=title, caption=caption, text=users_str) post = messages.post(session=self.session, title=title, caption=caption, text=users_str)
visibility_settings = dict(public=0, unlisted=1, private=2, direct=3) 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. post.message.visibility.SetSelection(visibility_settings.get(visibility))
# see https://github.com/MCV-Software/TWBlue/issues/504
post.message.visibility.SetSelection(visibility_settings.get("unlisted"))
# Respect content warning settings. # Respect content warning settings.
if item.sensitive: if item.sensitive:
post.message.sensitive.SetValue(item.sensitive) post.message.sensitive.SetValue(item.sensitive)