mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Feat: Added muting posts.
This commit is contained in:
parent
aee2a3b8b2
commit
2a1d86f917
@ -8,6 +8,7 @@ TWBlue Changelog
|
|||||||
* TWBlue should be able to switch to Windows 11 Keymap when running under Windows 11. ([#494](https://github.com/mcv-software/twblue/issues/494))
|
* TWBlue should be able to switch to Windows 11 Keymap when running under Windows 11. ([#494](https://github.com/mcv-software/twblue/issues/494))
|
||||||
* Mastodon:
|
* Mastodon:
|
||||||
* When viewing a post, a button displays the number of boosts and times it has been added to favorites. Clicking on that button will open a list of users who have interacted with the post. From that list, it is possible to view profiles and perform common user actions.
|
* When viewing a post, a button displays the number of boosts and times it has been added to favorites. Clicking on that button will open a list of users who have interacted with the post. From that list, it is possible to view profiles and perform common user actions.
|
||||||
|
* Now it is possible to mute conversations in Mastodon sessions. To do this, there is a button that can be called "Mute" or "Unmute Conversation" in the dialog to display the post. Conversations that have been muted will not generate notifications or mentions when they receive new replies. Only conversations that you are a part of can be muted.
|
||||||
* Fixed an error that caused TWBlue to be unable to properly display the user action dialog from the followers or following buffer. ([#575](https://github.com/mcv-software/twblue/issues/575))
|
* Fixed an error that caused TWBlue to be unable to properly display the user action dialog from the followers or following buffer. ([#575](https://github.com/mcv-software/twblue/issues/575))
|
||||||
|
|
||||||
## changes in version 2024.01.05
|
## changes in version 2024.01.05
|
||||||
|
@ -6,6 +6,7 @@ import widgetUtils
|
|||||||
import config
|
import config
|
||||||
import output
|
import output
|
||||||
from twitter_text import parse_tweet, config
|
from twitter_text import parse_tweet, config
|
||||||
|
from mastodon import MastodonError
|
||||||
from controller import messages
|
from controller import messages
|
||||||
from sessions.mastodon import templates
|
from sessions.mastodon import templates
|
||||||
from wxUI.dialogs.mastodon import postDialogs
|
from wxUI.dialogs.mastodon import postDialogs
|
||||||
@ -257,6 +258,13 @@ class viewPost(post):
|
|||||||
else:
|
else:
|
||||||
source = source_obj.get("name")
|
source = source_obj.get("name")
|
||||||
self.message = postDialogs.viewPost(text=text, boosts_count=boost_count, favs_count=favs_count, source=source, date=date, privacy=privacy)
|
self.message = postDialogs.viewPost(text=text, boosts_count=boost_count, favs_count=favs_count, source=source, date=date, privacy=privacy)
|
||||||
|
participants = [post.account.id] + [account.id for account in post.mentions]
|
||||||
|
print(post, participants)
|
||||||
|
if self.session.db["user_id"] in participants:
|
||||||
|
self.message.mute.Enable(True)
|
||||||
|
if post.muted:
|
||||||
|
self.message.mute.SetLabel(_("Unmute conversation"))
|
||||||
|
widgetUtils.connect_event(self.message.mute, widgetUtils.BUTTON_PRESSED, self.mute_unmute)
|
||||||
self.message.SetTitle(title)
|
self.message.SetTitle(title)
|
||||||
if image_description != "":
|
if image_description != "":
|
||||||
self.message.image_description.Enable(True)
|
self.message.image_description.Enable(True)
|
||||||
@ -275,6 +283,24 @@ class viewPost(post):
|
|||||||
def text_processor(self):
|
def text_processor(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def mute_unmute(self, *args, **kwargs):
|
||||||
|
post = self.session.api.status(self.post_id)
|
||||||
|
if post.muted == True:
|
||||||
|
action = "status_unmute"
|
||||||
|
new_label = _("Mute conversation")
|
||||||
|
msg = _("Conversation unmuted.")
|
||||||
|
else:
|
||||||
|
action = "status_mute"
|
||||||
|
new_label = _("Unmute conversation")
|
||||||
|
msg = _("Conversation muted.")
|
||||||
|
try:
|
||||||
|
getattr(self.session.api, action)(self.post_id)
|
||||||
|
self.message.mute.SetLabel(new_label)
|
||||||
|
output.speak(msg)
|
||||||
|
except MastodonError:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def on_boosts(self, *args, **kwargs):
|
def on_boosts(self, *args, **kwargs):
|
||||||
users = self.session.api.status_reblogged_by(self.post_id)
|
users = self.session.api.status_reblogged_by(self.post_id)
|
||||||
title = _("people who boosted this post")
|
title = _("people who boosted this post")
|
||||||
|
@ -228,12 +228,15 @@ class viewPost(wx.Dialog):
|
|||||||
|
|
||||||
def create_buttons_section(self, panel):
|
def create_buttons_section(self, panel):
|
||||||
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
self.mute = wx.Button(panel, wx.ID_ANY, _("Mute conversation"))
|
||||||
|
self.mute.Enable(False)
|
||||||
self.share = wx.Button(panel, wx.ID_ANY, _("Copy link to clipboard"))
|
self.share = wx.Button(panel, wx.ID_ANY, _("Copy link to clipboard"))
|
||||||
self.share.Enable(False)
|
self.share.Enable(False)
|
||||||
self.spellcheck = wx.Button(panel, wx.ID_ANY, _("Check &spelling..."))
|
self.spellcheck = wx.Button(panel, wx.ID_ANY, _("Check &spelling..."))
|
||||||
self.translateButton = wx.Button(panel, wx.ID_ANY, _("&Translate..."))
|
self.translateButton = wx.Button(panel, wx.ID_ANY, _("&Translate..."))
|
||||||
cancelButton = wx.Button(panel, wx.ID_CANCEL, _("C&lose"))
|
cancelButton = wx.Button(panel, wx.ID_CANCEL, _("C&lose"))
|
||||||
cancelButton.SetDefault()
|
cancelButton.SetDefault()
|
||||||
|
sizer.Add(self.mute, 0, wx.ALL, 5)
|
||||||
sizer.Add(self.share, 0, wx.ALL, 5)
|
sizer.Add(self.share, 0, wx.ALL, 5)
|
||||||
sizer.Add(self.spellcheck, 0, wx.ALL, 5)
|
sizer.Add(self.spellcheck, 0, wx.ALL, 5)
|
||||||
sizer.Add(self.translateButton, 0, wx.ALL, 5)
|
sizer.Add(self.translateButton, 0, wx.ALL, 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user