mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Mastodon: Show dialog before dismissing a notification. Mention notifications will make the mention to not be loaded in mentions buffer, as TWBlue reads mentions from the notifications data
This commit is contained in:
parent
b8647c29ea
commit
b0fa59cc01
@ -2,9 +2,11 @@
|
||||
import time
|
||||
import logging
|
||||
import widgetUtils
|
||||
import output
|
||||
from controller.buffers.mastodon.base import BaseBuffer
|
||||
from sessions.mastodon import compose, templates
|
||||
from wxUI import buffers
|
||||
from wxUI.dialogs.mastodon import dialogs as mastodon_dialogs
|
||||
|
||||
log = logging.getLogger("controller.buffers.mastodon.notifications")
|
||||
|
||||
@ -46,6 +48,9 @@ class NotificationsBuffer(BaseBuffer):
|
||||
def destroy_status(self, *args, **kwargs):
|
||||
index = self.buffer.list.get_selected()
|
||||
item = self.session.db[self.name][index]
|
||||
answer = mastodon_dialogs.delete_notification_dialog()
|
||||
if answer == False:
|
||||
return
|
||||
items = self.session.db[self.name]
|
||||
try:
|
||||
self.session.api.notifications_dismiss(id=item.id)
|
||||
@ -54,4 +59,5 @@ class NotificationsBuffer(BaseBuffer):
|
||||
output.speak(_("Notification dismissed."))
|
||||
except Exception as e:
|
||||
self.session.sound.play("error.ogg")
|
||||
log.exception("")
|
||||
self.session.db[self.name] = items
|
||||
|
@ -18,6 +18,14 @@ def delete_post_dialog():
|
||||
dlg.Destroy()
|
||||
return result
|
||||
|
||||
def delete_notification_dialog():
|
||||
result = False
|
||||
dlg = wx.MessageDialog(None, _("Are you sure you want to dismiss this notification? If you dismiss a mention notification, it also disappears from your mentions buffer. The post is not going to be deleted from the instance, though."), _("Dismiss"), wx.ICON_QUESTION|wx.YES_NO)
|
||||
if dlg.ShowModal() == wx.ID_YES:
|
||||
result = True
|
||||
dlg.Destroy()
|
||||
return result
|
||||
|
||||
def clear_list():
|
||||
result = False
|
||||
dlg = wx.MessageDialog(None, _("Do you really want to empty this buffer? It's items will be removed from the list but not from the instance"), _(u"Empty buffer"), wx.ICON_QUESTION|wx.YES_NO)
|
||||
|
Loading…
Reference in New Issue
Block a user