comparison libervia/web/pages/chat/page_meta.py @ 1619:a2cd4222c702

browser: Updates for new design: This patch add code to handle the new design for chat. New bridge method are used to invite users to MUC or get list of occupants. A new modules is used for components, with a first one for collapsible cards. rel 457
author Goffi <goffi@goffi.org>
date Sat, 12 Apr 2025 00:21:45 +0200
parents 7941444c1671
children
comparison
equal deleted inserted replaced
1618:5d9889f14012 1619:a2cd4222c702
22 rdata = self.get_r_data(request) 22 rdata = self.get_r_data(request)
23 23
24 try: 24 try:
25 target_jid_s = self.next_path(request) 25 target_jid_s = self.next_path(request)
26 except IndexError: 26 except IndexError:
27 # not chat jid, we redirect to jid selection page 27 target_jid_s = "goffi@tazar3.int"
28 self.page_redirect("chat_select", request) 28 # # not chat jid, we redirect to jid selection page
29 return 29 # self.page_redirect("chat_select", request)
30 # return
30 31
31 try: 32 try:
32 target_jid = jid.JID(target_jid_s) 33 target_jid = jid.JID(target_jid_s)
33 if not target_jid.local: 34 if not target_jid.local:
34 raise ValueError(_("invalid jid for chat (no local part)")) 35 raise ValueError(_("invalid jid for chat (no local part)"))
47 template_data = request.template_data 48 template_data = request.template_data
48 rdata = self.get_r_data(request) 49 rdata = self.get_r_data(request)
49 target_jid = rdata["target"] 50 target_jid = rdata["target"]
50 profile = session.profile 51 profile = session.profile
51 profile_jid = session.jid 52 profile_jid = session.jid
53
54 bookmarks = data_format.deserialise(
55 await self.host.bridge_call( "bookmarks_list", "", profile)
56 )
52 57
53 disco = await self.host.bridge_call( 58 disco = await self.host.bridge_call(
54 "disco_infos", target_jid.domain, "", True, profile 59 "disco_infos", target_jid.domain, "", True, profile
55 ) 60 )
56 if "conference" in [i[0] for i in disco[1]]: 61 if "conference" in [i[0] for i in disco[1]]:
95 100
96 template_data["messages"] = data_objects.Messages(history) 101 template_data["messages"] = data_objects.Messages(history)
97 rdata['identities'] = identities 102 rdata['identities'] = identities
98 template_data["target_jid"] = target_jid 103 template_data["target_jid"] = target_jid
99 template_data["chat_type"] = chat_type 104 template_data["chat_type"] = chat_type
105 template_data["bookmarks"] = bookmarks
106 template_data["chat_url"] = self.url
100 self.expose_to_scripts( 107 self.expose_to_scripts(
101 request, 108 request,
102 room_subject=room_subject, 109 room_subject=room_subject,
103 own_local_jid=str(own_local_jid), 110 own_local_jid=str(own_local_jid),
104 target_jid=target_jid, 111 target_jid=target_jid,
105 chat_type=chat_type, 112 chat_type=chat_type,
113 chat_url=self.url
106 ) 114 )
107 115
108 116
109 def on_data(self, request, data): 117 def on_data(self, request, data):
110 session = self.host.get_session_data(request, session_iface.IWebSession) 118 session = self.host.get_session_data(request, session_iface.IWebSession)