Daniel Brötzmann pushed to branch storage at gajim / gajim
Commits:
15028137 by wurstsalat at 2024-03-24T18:09:14+01:00
fix: Don't allow retraction of moderated messages
- - - - -
2 changed files:
- gajim/gtk/conversation/rows/message.py
- gajim/gtk/menus.py
Changes:
=====================================
gajim/gtk/conversation/rows/message.py
=====================================
@@ -70,6 +70,8 @@ def __init__(self,
self._original_text = message.text
self._original_message = message
+ self._is_retracted = message.moderation is not None
+
self._avatar_box = AvatarBox(contact)
self._meta_box = Gtk.Box(spacing=6)
@@ -246,7 +248,9 @@ def _on_more_menu_button_clicked(self, button: Gtk.Button)
-> None:
self.stanza_id,
self.orig_log_line_id,
self.log_line_id,
- self.state)
+ self.state,
+ self._is_retracted
+ )
popover = GajimPopover(menu, relative_to=button)
popover.popup()
@@ -403,6 +407,8 @@ def set_retracted(self, text: str) -> None:
self._message_widget.add_with_styling(text)
self.get_style_context().add_class('retracted-message')
+ self._is_retracted = True
+
def set_correction(self) -> None:
self.show_receipt(False)
=====================================
gajim/gtk/menus.py
=====================================
@@ -695,6 +695,7 @@ def get_chat_row_menu(contact: types.ChatContactT,
pk: int | None,
corrected_pk: int | None,
state: MessageState,
+ is_retracted: bool
) -> GajimMenu:
menu_items: MenuItemListT = []
@@ -742,7 +743,7 @@ def get_chat_row_menu(contact: types.ChatContactT,
menu_items.append((
p_('Message row action', 'Correct…'), 'win.correct-message', None))
- show_retract = False
+ retract_possible = False
if isinstance(contact, GroupchatContact) and contact.is_joined:
resource_contact = contact.get_resource(name)
self_contact = contact.get_self()
@@ -752,10 +753,11 @@ def get_chat_row_menu(contact: types.ChatContactT,
disco_info = app.storage.cache.get_last_disco_info(contact.jid)
assert disco_info is not None
- if disco_info.has_message_moderation and is_allowed:
- show_retract = True
+ if (disco_info.has_message_moderation and is_allowed
+ and not is_retracted):
+ retract_possible = True
- if (show_retract and stanza_id is not None
+ if (retract_possible and stanza_id is not None
and state == MessageState.ACKNOWLEDGED):
param = RetractMessageParam(
account=contact.account,
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/15028137f24cd1328ab6b80bd6f7baad0b43fcfc
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/15028137f24cd1328ab6b80bd6f7baad0b43fcfc
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]