mirror of https://gitlab.com/bashrc2/epicyon
Only create linker link if likes exist for a post
parent
fd80babfb8
commit
d97395bb9a
|
@ -10469,6 +10469,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.cw_lists,
|
||||
self.server.lists_enabled,
|
||||
'inbox', self.server.default_timeline)
|
||||
if not msg:
|
||||
self._404()
|
||||
return True
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
|
|
@ -52,7 +52,9 @@ def html_likers_of_post(base_dir: str, nickname: str,
|
|||
post_json_object = \
|
||||
locate_post(base_dir, nickname, domain, post_url)
|
||||
if not post_json_object:
|
||||
return html_str + html_footer()
|
||||
return None
|
||||
if not post_json_object.get('actor') or not post_json_object.get('object'):
|
||||
return None
|
||||
|
||||
# show the top banner
|
||||
banner_file, _ = \
|
||||
|
@ -101,11 +103,11 @@ def html_likers_of_post(base_dir: str, nickname: str,
|
|||
if has_object_dict(post_json_object):
|
||||
obj = post_json_object['object']
|
||||
if not obj.get('likes'):
|
||||
return html_str + html_footer()
|
||||
return None
|
||||
if not isinstance(obj['likes'], dict):
|
||||
return html_str + html_footer()
|
||||
return None
|
||||
if not obj['likes'].get('items'):
|
||||
return html_str + html_footer()
|
||||
return None
|
||||
|
||||
html_str += '<center><h2>' + translate['Liked by'] + '</h2></center>\n'
|
||||
|
||||
|
|
|
@ -659,18 +659,23 @@ def _get_like_icon_html(nickname: str, domain_full: str,
|
|||
like_str += '</label>\n'
|
||||
like_post_id = remove_hash_from_post_id(post_json_object['id'])
|
||||
like_post_id = remove_id_ending(like_post_id)
|
||||
|
||||
# create the link to likers of the post
|
||||
likers_post_id = like_post_id.replace('/', '--')
|
||||
likers_screen_link = \
|
||||
'/users/' + nickname + '?likers=' + likers_post_id
|
||||
likers_screen_link = like_title + like_count_str
|
||||
if like_count > 0:
|
||||
likers_screen_link = \
|
||||
'/users/' + nickname + '?likers=' + likers_post_id
|
||||
likers_screen_link = \
|
||||
'<a href=' + "'" + likers_screen_link + "'>" + \
|
||||
like_title + like_count_str + '</a>'
|
||||
like_str += \
|
||||
' <a class="imageAnchor" href="/users/' + nickname + '?' + \
|
||||
like_link + '=' + like_post_id + \
|
||||
page_number_param + \
|
||||
'?actor=' + post_json_object['actor'] + \
|
||||
'?bm=' + timeline_post_bookmark + \
|
||||
'?tl=' + box_name + '" title="' + \
|
||||
'<a href=' + "'" + likers_screen_link + "'>" + \
|
||||
like_title + like_count_str + '</a>">\n'
|
||||
'?tl=' + box_name + '" title="' + likers_screen_link + '">\n'
|
||||
like_str += \
|
||||
' ' + \
|
||||
'<img loading="lazy" title="' + like_title + like_count_str + \
|
||||
|
|
Loading…
Reference in New Issue