Philipp Hörist pushed to branch storage at gajim / gajim
Commits:
0519733a by Philipp Hörist at 2024-03-17T22:36:10+01:00
imprv: Merge on same message state
- - - - -
2 changed files:
- gajim/gtk/conversation/rows/message.py
- gajim/gtk/conversation/view.py
Changes:
=====================================
gajim/gtk/conversation/rows/message.py
=====================================
@@ -64,7 +64,7 @@ def __init__(self,
self.stanza_id = message.stanza_id
self.direction = ChatDirection(message.direction)
- self._orig_log_line_id = message.pk
+ self.orig_log_line_id = message.pk
assert message.text is not None
self._original_text = message.text
@@ -174,9 +174,11 @@ def update_with_content(self, message: Message) -> None:
marker.type == ChatMarkerType.RECEIVED):
self.show_receipt(True)
+ self.state = MessageState(message.state)
+
if (self._contact.is_groupchat and
self.direction == ChatDirection.OUTGOING):
- self.show_group_chat_message_state(MessageState(message.state))
+ self.show_group_chat_message_state(self.state)
if message.error is not None:
if message.error.text is not None:
@@ -242,7 +244,7 @@ def _on_more_menu_button_clicked(self, button: Gtk.Button)
-> None:
self.timestamp,
self.message_id,
self.stanza_id,
- self._orig_log_line_id,
+ self.orig_log_line_id,
self.log_line_id)
popover = GajimPopover(menu, relative_to=button)
@@ -333,9 +335,14 @@ def is_same_securitylabels(self, message: MessageRow) ->
bool:
return True
return False
+ def is_same_state(self, message: MessageRow) -> bool:
+ return message.state == self.state
+
def is_mergeable(self, message: MessageRow) -> bool:
if message.type != self.type:
return False
+ if not self.is_same_state(message):
+ return False
if self._original_message.corrections:
return False
if not self.is_same_sender(message):
@@ -376,6 +383,7 @@ def show_receipt(self, show: bool) -> None:
self._message_icons.set_receipt_icon_visible(show)
def show_group_chat_message_state(self, state: MessageState) -> None:
+ self.state = state
self._message_icons.set_group_chat_message_state_icon(state)
def show_error(self, tooltip: str) -> None:
=====================================
gajim/gtk/conversation/view.py
=====================================
@@ -678,10 +678,7 @@ def acknowledge_message(self, log_line_id: int) -> None:
return
row.show_group_chat_message_state(MessageState.ACKNOWLEDGED)
- index = row.get_index()
- decendant_row = self._list_box.get_row_at_index(index)
- if isinstance(decendant_row, MessageRow):
- decendant_row.set_merged(False)
+ self._check_for_merge(row)
def scroll_to_message_and_highlight(self, log_line_id: int) -> None:
highlight_row = None
@@ -754,7 +751,7 @@ def get_row_by_log_line_id(self, log_line_id: int) ->
MessageRow | None:
if not isinstance(row, MessageRow):
continue
if (row.log_line_id == log_line_id or
- row._orig_log_line_id == log_line_id):
+ row.orig_log_line_id == log_line_id):
return row
return None
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/0519733a80e363a147b1665dcaa43da1f1b9620d
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/0519733a80e363a147b1665dcaa43da1f1b9620d
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]