Mercurial > libervia-web
comparison libervia/web/pages/chat/_browser/__init__.py @ 1623:fdb5689fb826
browser (chat): Update following template change + some cleaning:
- Some templates have been moved from `chat` to `components` to be re-used, this patch
adapt the code consequently.
- Remove now unused `select` page.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 21 May 2025 15:57:21 +0200 |
parents | 3a60bf3762ef |
children |
comparison
equal
deleted
inserted
replaced
1622:c2065de5f6d0 | 1623:fdb5689fb826 |
---|---|
256 self._input_mode = "normal" | 256 self._input_mode = "normal" |
257 self.input_data = {} | 257 self.input_data = {} |
258 self.direct_messages_tpl = Template("chat/direct_messages.html") | 258 self.direct_messages_tpl = Template("chat/direct_messages.html") |
259 self.message_tpl = Template("chat/message.html") | 259 self.message_tpl = Template("chat/message.html") |
260 self.extra_menu_tpl = Template("chat/extra_menu.html") | 260 self.extra_menu_tpl = Template("chat/extra_menu.html") |
261 self.reactions_tpl = Template("chat/reactions.html") | 261 self.reactions_tpl = Template("components/reactions.html") |
262 self.reactions_details_tpl = Template("chat/reactions_details.html") | 262 self.reactions_details_tpl = Template("components/reactions_details.html") |
263 self.url_preview_control_tpl = Template("components/url_preview_control.html") | 263 self.url_preview_control_tpl = Template("components/url_preview_control.html") |
264 self.url_preview_tpl = Template("components/url_preview.html") | 264 self.url_preview_tpl = Template("components/url_preview.html") |
265 self.new_messages_marker_elt = Template("chat/new_messages_marker.html").get_elt() | 265 self.new_messages_marker_elt = Template("chat/new_messages_marker.html").get_elt() |
266 self.editions_tpl = Template("chat/editions.html") | 266 self.editions_tpl = Template("chat/editions.html") |
267 self.occupant_item_tpl = Template("chat/occupant_item.html") | 267 self.occupant_item_tpl = Template("chat/occupant_item.html") |
539 log.debug(f"Message {uid} not found, no reactions to update") | 539 log.debug(f"Message {uid} not found, no reactions to update") |
540 else: | 540 else: |
541 log.debug(f"Message {uid} found, new reactions: {reactions}") | 541 log.debug(f"Message {uid} found, new reactions: {reactions}") |
542 reactions_elt = self.reactions_tpl.get_elt( | 542 reactions_elt = self.reactions_tpl.get_elt( |
543 { | 543 { |
544 "chat_type": chat_type, | 544 "own_jid": str( |
545 "own_local_jid": str(own_local_jid), | 545 own_local_jid if chat_type == "group" else own_local_jid.bare |
546 ), | |
546 "reactions": reactions | 547 "reactions": reactions |
547 }) | 548 }) |
548 reactions_wrapper_elt.clear() | 549 reactions_wrapper_elt.clear() |
549 reactions_wrapper_elt <= reactions_elt | 550 reactions_wrapper_elt <= reactions_elt |
550 self.add_reactions_listeners(reactions_elt) | 551 self.add_reactions_listeners(reactions_elt) |
865 assert thread_messages_elt is not None | 866 assert thread_messages_elt is not None |
866 history_data = await bridge.history_get( | 867 history_data = await bridge.history_get( |
867 "", "", -2, True, {"thread_id": thread_id} | 868 "", "", -2, True, {"thread_id": thread_id} |
868 ) | 869 ) |
869 for message_data in history_data: | 870 for message_data in history_data: |
870 uid, timestamp, from_jid, to_jid, message_data, subject_data, mess_type, extra = message_data | 871 uid, timestamp, from_jid_s, to_jid_s, message_data, subject_data, mess_type, extra_s = message_data |
871 template_data = await self.message_to_template_data( | 872 template_data = await self.message_to_template_data( |
872 uid, | 873 uid, |
873 timestamp=timestamp, | 874 timestamp=timestamp, |
874 from_jid=from_jid, | 875 from_jid=jid.JID(from_jid_s), |
875 to_jid=to_jid, | 876 to_jid=jid.JID(to_jid_s), |
876 message_data=message_data, | 877 message_data=message_data, |
877 subject_data=subject_data, | 878 subject_data=subject_data, |
878 mess_type=mess_type, | 879 mess_type=mess_type, |
879 extra=json.loads(extra) | 880 extra=json.loads(extra_s) |
880 ) | 881 ) |
881 message_elt = self.message_tpl.get_elt(template_data) | 882 message_elt = self.message_tpl.get_elt(template_data) |
882 thread_messages_elt <= message_elt | 883 thread_messages_elt <= message_elt |
883 # FIXME: The whole input-panel is currently moved to the thread panel so listeners | 884 # FIXME: The whole input-panel is currently moved to the thread panel so listeners |
884 # don't have to be moved. At some point, it may be better to make a clone | 885 # don't have to be moved. At some point, it may be better to make a clone |