Mercurial > libervia-web
view libervia/web/pages/u/page_meta.py @ 1595:7941444c1671
pages: set `own_local_jid` to avoid confusion with `own_jid`:
- `own_jid` is the real JID of the user.
- `own_local_jid` is the JID used in chat, which can be real JID, or a room JID.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 13 Dec 2023 22:05:48 +0100 |
parents | eb00d593801d |
children |
line wrap: on
line source
#!/usr/bin/env python3 from libervia.web.server.constants import Const as C from twisted.internet import defer from twisted.words.protocols.jabber import jid """page used to target a user profile, e.g. for public blog""" name = "user" access = C.PAGES_ACCESS_PUBLIC # can be a callable template = "blog/articles.html" url_cache = True @defer.inlineCallbacks def parse_url(self, request): try: prof_requested = self.next_path(request) except IndexError: self.page_error(request) data = self.get_r_data(request) target_profile = yield self.host.bridge_call("profile_name_get", prof_requested) request.template_data["target_profile"] = target_profile target_jid = yield self.host.bridge_call( "param_get_a_async", "JabberID", "Connection", "value", profile_key=target_profile ) target_jid = jid.JID(target_jid) data["service"] = target_jid # if URL is parsed here, we'll have atom.xml available and we need to # add the link to the page atom_url = self.get_sub_page_url(request, 'user_blog_feed_atom') request.template_data['atom_url'] = atom_url request.template_data.setdefault('links', []).append({ "href": atom_url, "type": "application/atom+xml", "rel": "alternate", "title": "{target_profile}'s blog".format(target_profile=target_profile)}) def add_breadcrumb(self, request, breadcrumbs): # we don't want a breadcrumb here pass @defer.inlineCallbacks def prepare_render(self, request): data = self.get_r_data(request) self.check_cache( request, C.CACHE_PUBSUB, service=data["service"], node=None, short="microblog" ) self.page_redirect("blog_view", request) def on_data_post(self, request): return self.get_page_by_name("blog_view").on_data_post(self, request)