Philipp Hörist pushed to branch mention-indicator at gajim / gajim
Commits:
63db85ac by Philipp Hörist at 2026-04-11T20:47:08+02:00
cfix: Simplify sameness check
- - - - -
1 changed file:
- gajim/gtk/conversation/rows/message.py
Changes:
=====================================
gajim/gtk/conversation/rows/message.py
=====================================
@@ -132,6 +132,10 @@ def has_receipt(self) -> bool:
def is_merged(self) -> bool:
return self._merged
+ @property
+ def has_mention(self) -> bool:
+ return self._mention_indicator.get_visible()
+
@property
def occupant_id(self) -> str | None:
if self._message.occupant is None:
@@ -347,14 +351,11 @@ def _apply_highlight(self, text: str) -> None:
if self._contact.nickname is None:
return
- if message_needs_highlight(
+ needs_highlight = message_needs_highlight(
text, self._contact.nickname, self._client.get_own_jid().bare
- ):
- self._mention_indicator.set_visible(True)
- self._message_icons.set_mention_icon_visibe(True)
- else:
- self._mention_indicator.set_visible(False)
- self._message_icons.set_mention_icon_visibe(False)
+ )
+ self._mention_indicator.set_visible(needs_highlight)
+ self._message_icons.set_mention_icon_visibe(needs_highlight)
def is_same_sender(self, message: MessageRow) -> bool:
return message.name == self.name
@@ -392,23 +393,7 @@ def has_same_receipt_status(self, message: MessageRow) ->
bool:
return self._has_receipt == message.has_receipt
def is_same_mention_state(self, message: MessageRow) -> bool:
- if not isinstance(self._contact, GroupchatContact):
- return True
-
- if self._contact.nickname is None:
- return True
-
- if self._message.text is None:
- return True
-
- own_bare_jid = self._client.get_own_jid().bare
- this_message_needs_highlight = message_needs_highlight(
- self._message.text, self._contact.nickname, own_bare_jid
- )
- other_message_needs_highlight = message_needs_highlight(
- message.text, self._contact.nickname, own_bare_jid
- )
- return this_message_needs_highlight == other_message_needs_highlight
+ return self.has_mention is message.has_mention
def is_mergeable(self, message: MessageRow) -> bool:
if message.type != self.type:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/63db85ac814ef5706c0b68d5191a00293c7a698d
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/63db85ac814ef5706c0b68d5191a00293c7a698d
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]