Mercurial > libervia-web
comparison libervia/pages/blog/view/page_meta.py @ 1133:122dd136d1ab
pages (blog/view): allow commenting when profile is connected
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 03 Oct 2018 20:46:44 +0200 |
parents | 28e3eb3bb217 |
children | dfd6545a205a |
comparison
equal
deleted
inserted
replaced
1132:0cafb79ced6d | 1133:122dd136d1ab |
---|---|
152 # if the comments are not explicitly hidden, we show them | 152 # if the comments are not explicitly hidden, we show them |
153 service, node, item_id, show_comments = data.get(u'service', u''), data.get(u'node', u''), data.get(u'item'), data.get(u'show_comments', True) | 153 service, node, item_id, show_comments = data.get(u'service', u''), data.get(u'node', u''), data.get(u'item'), data.get(u'show_comments', True) |
154 profile = self.getProfile(request) | 154 profile = self.getProfile(request) |
155 if profile is None: | 155 if profile is None: |
156 profile = C.SERVICE_PROFILE | 156 profile = C.SERVICE_PROFILE |
157 profile_connected = False | |
158 else: | |
159 profile_connected = True | |
157 | 160 |
158 ## pagination/filtering parameters | 161 ## pagination/filtering parameters |
159 params = self.getAllPostedData(request, multiple=False) | 162 params = self.getAllPostedData(request, multiple=False) |
160 if item_id: | 163 if item_id: |
161 extra = {} | 164 extra = {} |
201 if items: | 204 if items: |
202 last_id = items[-1].id | 205 last_id = items[-1].id |
203 template_data['older_url'] = self.getParamURL(request, after=last_id) | 206 template_data['older_url'] = self.getParamURL(request, after=last_id) |
204 | 207 |
205 ## identities ## | 208 ## identities ## |
206 # identities are use to show nice nickname or avatars | 209 # identities are used to show nice nickname or avatars |
207 identities = template_data[u'identities'] = self.host.getSessionData(request, session_iface.ISATSession).identities | 210 identities = template_data[u'identities'] = self.host.getSessionData(request, session_iface.ISATSession).identities |
208 | 211 |
209 ## Comments ## | 212 ## Comments ## |
210 # if comments are requested, we need to take them | 213 # if comments are requested, we need to take them |
211 if show_comments: | 214 if show_comments: |
263 if tag not in tags_http_uri: | 266 if tag not in tags_http_uri: |
264 tag_url = u'/'.join([blog_base_url_tag, utils.quote(tag)]) | 267 tag_url = u'/'.join([blog_base_url_tag, utils.quote(tag)]) |
265 tags_http_uri[tag] = self.host.getExtBaseURL(request, tag_url) | 268 tags_http_uri[tag] = self.host.getExtBaseURL(request, tag_url) |
266 | 269 |
267 # if True, page should display a comment box | 270 # if True, page should display a comment box |
268 template_data[u'allow_commenting'] = data.get(u'allow_commenting', False) | 271 template_data[u'allow_commenting'] = data.get(u'allow_commenting', profile_connected) |
269 | 272 |
270 # last but not least, we add a xmpp: link to the node | 273 # last but not least, we add a xmpp: link to the node |
271 uri_args = {u'path': service.full()} | 274 uri_args = {u'path': service.full()} |
272 if node: | 275 if node: |
273 uri_args[u'node'] = node | 276 uri_args[u'node'] = node |