From 07ef6e7c773fabb2c5c9a8f5e3fb9fd1c3cba888 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 2 Mar 2022 11:03:56 +0000 Subject: [PATCH 1/5] Include emoji in display names on likers screen --- webapp_likers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp_likers.py b/webapp_likers.py index 088f69104..8612d447f 100644 --- a/webapp_likers.py +++ b/webapp_likers.py @@ -18,6 +18,7 @@ from utils import load_json from webapp_utils import html_header_with_external_style from webapp_utils import html_footer from webapp_utils import get_banner_file +from webapp_utils import add_emoji_to_display_name from webapp_post import individual_post_as_html @@ -123,6 +124,12 @@ def html_likers_of_post(base_dir: str, nickname: str, get_display_name(base_dir, liker_actor, person_cache) if liker_display_name: liker_name = liker_display_name + if ':' in liker_name: + liker_name = \ + add_emoji_to_display_name(session, base_dir, + http_prefix, + nickname, domain, + liker_name, False) else: liker_name = get_nickname_from_actor(liker_actor) if likers_list: From 101fe83251286f5e5017cbc19ace431257e5bc3f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 2 Mar 2022 12:01:05 +0000 Subject: [PATCH 2/5] Link to person options from likers screen --- cache.py | 8 ++++---- daemon.py | 8 ++++++-- webapp_likers.py | 9 ++++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cache.py b/cache.py index c0ba795ce..10deff344 100644 --- a/cache.py +++ b/cache.py @@ -34,18 +34,18 @@ def _remove_person_from_cache(base_dir: str, person_url: str, def check_for_changed_actor(session, base_dir: str, http_prefix: str, domain_full: str, - person_url: str, avatarUrl: str, person_cache: {}, + person_url: str, avatar_url: str, person_cache: {}, timeout_sec: int): """Checks if the avatar url exists and if not then the actor has probably changed without receiving an actor/Person Update. So clear the actor from the cache and it will be refreshed when the next post from them is sent """ - if not session or not avatarUrl: + if not session or not avatar_url: return - if domain_full in avatarUrl: + if domain_full in avatar_url: return - if url_exists(session, avatarUrl, timeout_sec, http_prefix, domain_full): + if url_exists(session, avatar_url, timeout_sec, http_prefix, domain_full): return _remove_person_from_cache(base_dir, person_url, person_cache) diff --git a/daemon.py b/daemon.py index bf805dccb..4ddb92dc8 100644 --- a/daemon.py +++ b/daemon.py @@ -7427,8 +7427,12 @@ class PubServer(BaseHTTPRequestHandler): page_number = 1 options_list = options_str.split(';') options_actor = options_list[0] - options_page_number = options_list[1] - options_profile_url = options_list[2] + options_page_number = 1 + if len(options_list) > 1: + options_page_number = options_list[1] + options_profile_url = '' + if len(options_list) > 2: + options_profile_url = options_list[2] if '.' in options_profile_url and \ options_profile_url.startswith('/members/'): ext = options_profile_url.split('.')[-1] diff --git a/webapp_likers.py b/webapp_likers.py index 8612d447f..2dbaaa939 100644 --- a/webapp_likers.py +++ b/webapp_likers.py @@ -15,6 +15,7 @@ from utils import get_display_name from utils import get_nickname_from_actor from utils import has_object_dict from utils import load_json +from person import get_person_avatar_url from webapp_utils import html_header_with_external_style from webapp_utils import html_footer from webapp_utils import get_banner_file @@ -134,9 +135,15 @@ def html_likers_of_post(base_dir: str, nickname: str, liker_name = get_nickname_from_actor(liker_actor) if likers_list: likers_list += ' ' + liker_avatar_url = \ + get_person_avatar_url(base_dir, liker_actor, + person_cache, False) + liker_options_link = \ + '/users/' + nickname + '?options=' + \ + liker_actor + ';1;' + liker_avatar_url likers_list += \ '' html_str += '
\n' + likers_list + '\n
\n' From b1701db6dd903d28f82a5e2ea043453b1ca63539 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 2 Mar 2022 13:49:51 +0000 Subject: [PATCH 3/5] Add count of announces to posts --- announce.py | 17 +++++++++++++++++ translations/ar.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/ku.json | 3 ++- translations/oc.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/sw.json | 3 ++- translations/zh.json | 3 ++- webapp_post.py | 35 +++++++++++++++++++++++++++++++---- 19 files changed, 82 insertions(+), 21 deletions(-) diff --git a/announce.py b/announce.py index deae59b59..5538b72be 100644 --- a/announce.py +++ b/announce.py @@ -9,6 +9,7 @@ __module_group__ = "ActivityPub" from utils import has_object_string_object from utils import has_group_type +from utils import has_object_dict from utils import remove_domain_port from utils import remove_id_ending from utils import has_users_path @@ -33,6 +34,22 @@ from webfinger import webfinger_handle from auth import create_basic_auth_header +def no_of_announces(post_json_object: {}) -> int: + """Returns the number of announces on a given post + """ + obj = post_json_object + if has_object_dict(post_json_object): + obj = post_json_object['object'] + if not obj.get('shares'): + return 0 + if not isinstance(obj['shares'], dict): + return 0 + if not obj['shares'].get('items'): + obj['shares']['items'] = [] + obj['shares']['totalItems'] = 0 + return len(obj['shares']['items']) + + def is_self_announce(post_json_object: {}) -> bool: """Is the given post a self announce? """ diff --git a/translations/ar.json b/translations/ar.json index c957dc507..05452a4e5 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -512,5 +512,6 @@ "Created": "مخلوق", "It is done": "تم", "Time Zone": "وحدة زمنية", - "Show who liked this post": "أظهر من أحب هذا المنشور" + "Show who liked this post": "أظهر من أحب هذا المنشور", + "Show who repeated this post": "أظهر من كرر هذا المنصب" } diff --git a/translations/ca.json b/translations/ca.json index dacb28c4b..e302485b2 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -512,5 +512,6 @@ "Created": "Creat", "It is done": "Esta fet", "Time Zone": "Fus horari", - "Show who liked this post": "Mostra a qui li agrada aquesta publicació" + "Show who liked this post": "Mostra a qui li agrada aquesta publicació", + "Show who repeated this post": "Mostra qui ha repetit aquesta publicació" } diff --git a/translations/cy.json b/translations/cy.json index 9748400f2..4d5229c4b 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -512,5 +512,6 @@ "Created": "Wedi creu", "It is done": "Mae'n cael ei wneud", "Time Zone": "Parth Amser", - "Show who liked this post": "Dangoswch pwy oedd yn hoffi'r post hwn" + "Show who liked this post": "Dangoswch pwy oedd yn hoffi'r post hwn", + "Show who repeated this post": "Dangoswch pwy ailadroddodd y post hwn" } diff --git a/translations/de.json b/translations/de.json index 6affc0714..73bfb0822 100644 --- a/translations/de.json +++ b/translations/de.json @@ -512,5 +512,6 @@ "Created": "Erstellt", "It is done": "Es ist vollbracht", "Time Zone": "Zeitzone", - "Show who liked this post": "Zeigen, wem dieser Beitrag gefallen hat" + "Show who liked this post": "Zeigen, wem dieser Beitrag gefallen hat", + "Show who repeated this post": "Zeigen Sie, wer diesen Beitrag wiederholt hat" } diff --git a/translations/en.json b/translations/en.json index 6d63e9362..0dd4fc5c8 100644 --- a/translations/en.json +++ b/translations/en.json @@ -512,5 +512,6 @@ "Created": "Created", "It is done": "It is done", "Time Zone": "Time Zone", - "Show who liked this post": "Show who liked this post" + "Show who liked this post": "Show who liked this post", + "Show who repeated this post": "Show who repeated this post" } diff --git a/translations/es.json b/translations/es.json index 85622b5ec..1196f1d67 100644 --- a/translations/es.json +++ b/translations/es.json @@ -512,5 +512,6 @@ "Created": "Creada", "It is done": "Se hace", "Time Zone": "Zona horaria", - "Show who liked this post": "Mostrar a quién le gustó esta publicación" + "Show who liked this post": "Mostrar a quién le gustó esta publicación", + "Show who repeated this post": "Mostrar quién repitió esta publicación" } diff --git a/translations/fr.json b/translations/fr.json index d2e81c3cf..8ebd399e9 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -512,5 +512,6 @@ "Created": "Créé", "It is done": "C'est fait", "Time Zone": "Fuseau horaire", - "Show who liked this post": "Montrer qui a aimé ce post" + "Show who liked this post": "Montrer qui a aimé ce post", + "Show who repeated this post": "Montrer qui a répété ce post" } diff --git a/translations/ga.json b/translations/ga.json index 094738e3f..1ac2a0770 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -512,5 +512,6 @@ "Created": "Cruthaithe", "It is done": "Déantar é", "Time Zone": "Crios Ama", - "Show who liked this post": "Taispeáin cé a thaitin an postáil seo" + "Show who liked this post": "Taispeáin cé a thaitin an postáil seo", + "Show who repeated this post": "Taispeáin cé a rinne an postáil seo arís" } diff --git a/translations/hi.json b/translations/hi.json index ad4c7e2a2..a552331cc 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -512,5 +512,6 @@ "Created": "बनाया था", "It is done": "हो गया है", "Time Zone": "समय क्षेत्र", - "Show who liked this post": "दिखाएँ कि इस पोस्ट को किसने पसंद किया" + "Show who liked this post": "दिखाएँ कि इस पोस्ट को किसने पसंद किया", + "Show who repeated this post": "दिखाएं कि इस पोस्ट को किसने दोहराया" } diff --git a/translations/it.json b/translations/it.json index d9219f0a5..089f42203 100644 --- a/translations/it.json +++ b/translations/it.json @@ -512,5 +512,6 @@ "Created": "Creata", "It is done": "È fatta", "Time Zone": "Fuso orario", - "Show who liked this post": "Mostra a chi è piaciuto questo post" + "Show who liked this post": "Mostra a chi è piaciuto questo post", + "Show who repeated this post": "Mostra chi ha ripetuto questo post" } diff --git a/translations/ja.json b/translations/ja.json index 5c8c77d71..39a385707 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -512,5 +512,6 @@ "Created": "作成した", "It is done": "されております", "Time Zone": "タイムゾーン", - "Show who liked this post": "この投稿を高く評価した人を表示する" + "Show who liked this post": "この投稿を高く評価した人を表示する", + "Show who repeated this post": "この投稿を繰り返した人を表示する" } diff --git a/translations/ku.json b/translations/ku.json index f8ea5c51c..a8ee2241a 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -512,5 +512,6 @@ "Created": "Afirandin", "It is done": "Tê kirin", "Time Zone": "Qada demê", - "Show who liked this post": "Nîşan bide kê ev post eciband" + "Show who liked this post": "Nîşan bide kê ev post eciband", + "Show who repeated this post": "Nîşan bide kê ev post dubare kiriye" } diff --git a/translations/oc.json b/translations/oc.json index 95ebeb902..22dbdf955 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -508,5 +508,6 @@ "Created": "Created", "It is done": "It is done", "Time Zone": "Time Zone", - "Show who liked this post": "Show who liked this post" + "Show who liked this post": "Show who liked this post", + "Show who repeated this post": "Show who repeated this post" } diff --git a/translations/pt.json b/translations/pt.json index 84c1a68f2..626e09c8d 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -512,5 +512,6 @@ "Created": "Criada", "It is done": "Está feito", "Time Zone": "Fuso horário", - "Show who liked this post": "Mostrar quem gostou deste post" + "Show who liked this post": "Mostrar quem gostou deste post", + "Show who repeated this post": "Mostrar quem repetiu esta postagem" } diff --git a/translations/ru.json b/translations/ru.json index 34e0bce98..f80b33010 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -512,5 +512,6 @@ "Created": "Созданный", "It is done": "Сделано", "Time Zone": "Часовой пояс", - "Show who liked this post": "Показать, кому понравился этот пост" + "Show who liked this post": "Показать, кому понравился этот пост", + "Show who repeated this post": "Показать, кто повторил этот пост" } diff --git a/translations/sw.json b/translations/sw.json index ab7e8f5f8..0ed705e7d 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -512,5 +512,6 @@ "Created": "Imeundwa", "It is done": "Imefanyika", "Time Zone": "Eneo la Saa", - "Show who liked this post": "Onyesha ni nani aliyependa chapisho hili" + "Show who liked this post": "Onyesha ni nani aliyependa chapisho hili", + "Show who repeated this post": "Onyesha ni nani aliyerudia chapisho hili" } diff --git a/translations/zh.json b/translations/zh.json index 56b2b45ca..01b3487ec 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -512,5 +512,6 @@ "Created": "已创建", "It is done": "完成了", "Time Zone": "时区", - "Show who liked this post": "显示谁喜欢这篇文章" + "Show who liked this post": "显示谁喜欢这篇文章", + "Show who repeated this post": "显示谁重复了这篇文章" } diff --git a/webapp_post.py b/webapp_post.py index 0043b2233..59f40e1b8 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -16,6 +16,8 @@ from git import is_git_patch from datetime import datetime from cache import get_person_from_cache from bookmarks import bookmarked_by_person +from announce import announced_by_person +from announce import no_of_announces from like import liked_by_person from like import no_of_likes from follow import is_following_actor @@ -65,7 +67,6 @@ from content import get_mentions_from_html from content import switch_words from person import is_person_snoozed from person import get_person_avatar_url -from announce import announced_by_person from webapp_utils import get_banner_file from webapp_utils import get_avatar_image_url from webapp_utils import update_avatar_image_cache @@ -549,7 +550,8 @@ def _get_announce_icon_html(is_announced: bool, translate: {}, page_number_param: str, timeline_post_bookmark: str, - box_name: str) -> str: + box_name: str, + max_announce_count: int) -> str: """Returns html for announce icon/button """ announce_str = '' @@ -571,9 +573,19 @@ def _get_announce_icon_html(is_announced: bool, repeat_this_post_str = translate[repeat_this_post_str] announce_title = repeat_this_post_str unannounce_link_str = '' + announce_count = no_of_announces(post_json_object) + announce_count_str = '' + if announce_count > 0: + if announce_count <= max_announce_count: + announce_count_str = ' (' + str(announce_count) + ')' + else: + announce_count_str = ' (' + str(max_announce_count) + '+)' if announced_by_person(is_announced, post_actor, nickname, domain_full): + if announce_count == 1: + # announced by the reader only + announce_count_str = '' announce_icon = 'repeat.png' announce_emoji = '🔁 ' announce_link = 'unrepeat' @@ -590,9 +602,24 @@ def _get_announce_icon_html(is_announced: bool, announce_post_id = \ remove_hash_from_post_id(post_json_object['object']['id']) announce_post_id = remove_id_ending(announce_post_id) + + announce_str = '' + if announce_count_str: + announcers_post_id = announce_post_id.replace('/', '--') + announcers_screen_link = \ + '/users/' + nickname + '?announcers=' + announcers_post_id + + # show the number of announces next to icon + announce_str += '\n' + announce_link_str = '?' + \ announce_link + '=' + announce_post_id + page_number_param - announce_str = \ + announce_str += \ ' ' + \ '' + liker_name + '' + \ From 742c69163a0e260e36b08e9bebc0c6535d7c36e9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 2 Mar 2022 14:27:31 +0000 Subject: [PATCH 5/5] Screen showing announcers of a post --- daemon.py | 78 ++++++++++++++++++++++++++++++++++++++++++++ translations/ar.json | 3 +- translations/ca.json | 3 +- translations/cy.json | 3 +- translations/de.json | 3 +- translations/en.json | 3 +- translations/es.json | 3 +- translations/fr.json | 3 +- translations/ga.json | 3 +- translations/hi.json | 3 +- translations/it.json | 3 +- translations/ja.json | 3 +- translations/ku.json | 3 +- translations/oc.json | 3 +- translations/pt.json | 3 +- translations/ru.json | 3 +- translations/sw.json | 3 +- translations/zh.json | 3 +- webapp_likers.py | 18 ++++++---- 19 files changed, 124 insertions(+), 23 deletions(-) diff --git a/daemon.py b/daemon.py index 4ddb92dc8..c218f511a 100644 --- a/daemon.py +++ b/daemon.py @@ -10486,6 +10486,68 @@ class PubServer(BaseHTTPRequestHandler): self.server.debug) return True + def _show_announcers_of_post(self, authorized: bool, + calling_domain: str, path: str, + base_dir: str, http_prefix: str, + domain: str, domain_full: str, port: int, + onion_domain: str, i2p_domain: str, + getreq_start_time, + proxy_type: str, cookie: str, + debug: str) -> bool: + """Show the announcers of a post + """ + if not authorized: + return False + if '?announcers=' not in path: + return False + if '/users/' not in path: + return False + nickname = path.split('/users/')[1] + if '?' in nickname: + nickname = nickname.split('?')[0] + post_url = path.split('?announcers=')[1] + if '?' in post_url: + post_url = post_url.split('?')[0] + post_url = post_url.replace('--', '/') + + # note that the likers function is reused, but with 'shares' + msg = \ + html_likers_of_post(base_dir, nickname, domain, port, + post_url, self.server.translate, + http_prefix, + self.server.theme_name, + self.server.access_keys, + self.server.recent_posts_cache, + self.server.max_recent_posts, + self.server.session, + self.server.cached_webfingers, + self.server.person_cache, + self.server.project_version, + self.server.yt_replace_domain, + self.server.twitter_replacement_domain, + self.server.show_published_date_only, + self.server.peertube_instances, + self.server.allow_local_network_access, + self.server.system_language, + self.server.max_like_count, + self.server.signing_priv_key_pem, + self.server.cw_lists, + self.server.lists_enabled, + 'inbox', self.server.default_timeline, + 'shares') + if not msg: + self._404() + return True + msg = msg.encode('utf-8') + msglen = len(msg) + self._set_headers('text/html', msglen, + cookie, calling_domain, False) + self._write(msg) + fitness_performance(getreq_start_time, self.server.fitness, + '_GET', '_show_announcers_of_post', + self.server.debug) + return True + def _show_post_from_file(self, post_filename: str, liked_by: str, react_by: str, react_emoji: str, authorized: bool, @@ -16568,6 +16630,22 @@ class PubServer(BaseHTTPRequestHandler): self.server.getreq_busy = False return + # show the announcers/repeaters of a post + if self._show_announcers_of_post(authorized, + calling_domain, self.path, + self.server.base_dir, + self.server.http_prefix, + self.server.domain, + self.server.domain_full, + self.server.port, + self.server.onion_domain, + self.server.i2p_domain, + getreq_start_time, + self.server.proxy_type, + cookie, self.server.debug): + self.server.getreq_busy = False + return + fitness_performance(getreq_start_time, self.server.fitness, '_GET', 'individual post done', self.server.debug) diff --git a/translations/ar.json b/translations/ar.json index 05452a4e5..0cf00963a 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -513,5 +513,6 @@ "It is done": "تم", "Time Zone": "وحدة زمنية", "Show who liked this post": "أظهر من أحب هذا المنشور", - "Show who repeated this post": "أظهر من كرر هذا المنصب" + "Show who repeated this post": "أظهر من كرر هذا المنصب", + "Repeated by": "يتكرر بواسطة" } diff --git a/translations/ca.json b/translations/ca.json index e302485b2..28ee0a579 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -513,5 +513,6 @@ "It is done": "Esta fet", "Time Zone": "Fus horari", "Show who liked this post": "Mostra a qui li agrada aquesta publicació", - "Show who repeated this post": "Mostra qui ha repetit aquesta publicació" + "Show who repeated this post": "Mostra qui ha repetit aquesta publicació", + "Repeated by": "Repetit per" } diff --git a/translations/cy.json b/translations/cy.json index 4d5229c4b..3fc651630 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -513,5 +513,6 @@ "It is done": "Mae'n cael ei wneud", "Time Zone": "Parth Amser", "Show who liked this post": "Dangoswch pwy oedd yn hoffi'r post hwn", - "Show who repeated this post": "Dangoswch pwy ailadroddodd y post hwn" + "Show who repeated this post": "Dangoswch pwy ailadroddodd y post hwn", + "Repeated by": "Ailadrodd gan" } diff --git a/translations/de.json b/translations/de.json index 73bfb0822..a1c18d712 100644 --- a/translations/de.json +++ b/translations/de.json @@ -513,5 +513,6 @@ "It is done": "Es ist vollbracht", "Time Zone": "Zeitzone", "Show who liked this post": "Zeigen, wem dieser Beitrag gefallen hat", - "Show who repeated this post": "Zeigen Sie, wer diesen Beitrag wiederholt hat" + "Show who repeated this post": "Zeigen Sie, wer diesen Beitrag wiederholt hat", + "Repeated by": "Wiederholt von" } diff --git a/translations/en.json b/translations/en.json index 0dd4fc5c8..798823909 100644 --- a/translations/en.json +++ b/translations/en.json @@ -513,5 +513,6 @@ "It is done": "It is done", "Time Zone": "Time Zone", "Show who liked this post": "Show who liked this post", - "Show who repeated this post": "Show who repeated this post" + "Show who repeated this post": "Show who repeated this post", + "Repeated by": "Repeated by" } diff --git a/translations/es.json b/translations/es.json index 1196f1d67..1a2d74369 100644 --- a/translations/es.json +++ b/translations/es.json @@ -513,5 +513,6 @@ "It is done": "Se hace", "Time Zone": "Zona horaria", "Show who liked this post": "Mostrar a quién le gustó esta publicación", - "Show who repeated this post": "Mostrar quién repitió esta publicación" + "Show who repeated this post": "Mostrar quién repitió esta publicación", + "Repeated by": "Repetido por" } diff --git a/translations/fr.json b/translations/fr.json index 8ebd399e9..b1e5267c3 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -513,5 +513,6 @@ "It is done": "C'est fait", "Time Zone": "Fuseau horaire", "Show who liked this post": "Montrer qui a aimé ce post", - "Show who repeated this post": "Montrer qui a répété ce post" + "Show who repeated this post": "Montrer qui a répété ce post", + "Repeated by": "Répété par" } diff --git a/translations/ga.json b/translations/ga.json index 1ac2a0770..f2481b3f4 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -513,5 +513,6 @@ "It is done": "Déantar é", "Time Zone": "Crios Ama", "Show who liked this post": "Taispeáin cé a thaitin an postáil seo", - "Show who repeated this post": "Taispeáin cé a rinne an postáil seo arís" + "Show who repeated this post": "Taispeáin cé a rinne an postáil seo arís", + "Repeated by": "Arís agus arís eile ag" } diff --git a/translations/hi.json b/translations/hi.json index a552331cc..34b8a4e7f 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -513,5 +513,6 @@ "It is done": "हो गया है", "Time Zone": "समय क्षेत्र", "Show who liked this post": "दिखाएँ कि इस पोस्ट को किसने पसंद किया", - "Show who repeated this post": "दिखाएं कि इस पोस्ट को किसने दोहराया" + "Show who repeated this post": "दिखाएं कि इस पोस्ट को किसने दोहराया", + "Repeated by": "द्वारा दोहराया गया" } diff --git a/translations/it.json b/translations/it.json index 089f42203..0dab816ca 100644 --- a/translations/it.json +++ b/translations/it.json @@ -513,5 +513,6 @@ "It is done": "È fatta", "Time Zone": "Fuso orario", "Show who liked this post": "Mostra a chi è piaciuto questo post", - "Show who repeated this post": "Mostra chi ha ripetuto questo post" + "Show who repeated this post": "Mostra chi ha ripetuto questo post", + "Repeated by": "Ripetuto da" } diff --git a/translations/ja.json b/translations/ja.json index 39a385707..a12e4ab57 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -513,5 +513,6 @@ "It is done": "されております", "Time Zone": "タイムゾーン", "Show who liked this post": "この投稿を高く評価した人を表示する", - "Show who repeated this post": "この投稿を繰り返した人を表示する" + "Show who repeated this post": "この投稿を繰り返した人を表示する", + "Repeated by": "によって繰り返される" } diff --git a/translations/ku.json b/translations/ku.json index a8ee2241a..0b7fa9d3d 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -513,5 +513,6 @@ "It is done": "Tê kirin", "Time Zone": "Qada demê", "Show who liked this post": "Nîşan bide kê ev post eciband", - "Show who repeated this post": "Nîşan bide kê ev post dubare kiriye" + "Show who repeated this post": "Nîşan bide kê ev post dubare kiriye", + "Repeated by": "Ji hêla dubare kirin" } diff --git a/translations/oc.json b/translations/oc.json index 22dbdf955..bc717207f 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -509,5 +509,6 @@ "It is done": "It is done", "Time Zone": "Time Zone", "Show who liked this post": "Show who liked this post", - "Show who repeated this post": "Show who repeated this post" + "Show who repeated this post": "Show who repeated this post", + "Repeated by": "Repeated by" } diff --git a/translations/pt.json b/translations/pt.json index 626e09c8d..43d8080ef 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -513,5 +513,6 @@ "It is done": "Está feito", "Time Zone": "Fuso horário", "Show who liked this post": "Mostrar quem gostou deste post", - "Show who repeated this post": "Mostrar quem repetiu esta postagem" + "Show who repeated this post": "Mostrar quem repetiu esta postagem", + "Repeated by": "Repetido por" } diff --git a/translations/ru.json b/translations/ru.json index f80b33010..9ce09948a 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -513,5 +513,6 @@ "It is done": "Сделано", "Time Zone": "Часовой пояс", "Show who liked this post": "Показать, кому понравился этот пост", - "Show who repeated this post": "Показать, кто повторил этот пост" + "Show who repeated this post": "Показать, кто повторил этот пост", + "Repeated by": "Повторено" } diff --git a/translations/sw.json b/translations/sw.json index 0ed705e7d..7d5069316 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -513,5 +513,6 @@ "It is done": "Imefanyika", "Time Zone": "Eneo la Saa", "Show who liked this post": "Onyesha ni nani aliyependa chapisho hili", - "Show who repeated this post": "Onyesha ni nani aliyerudia chapisho hili" + "Show who repeated this post": "Onyesha ni nani aliyerudia chapisho hili", + "Repeated by": "Imerudiwa na" } diff --git a/translations/zh.json b/translations/zh.json index 01b3487ec..9a64482e6 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -513,5 +513,6 @@ "It is done": "完成了", "Time Zone": "时区", "Show who liked this post": "显示谁喜欢这篇文章", - "Show who repeated this post": "显示谁重复了这篇文章" + "Show who repeated this post": "显示谁重复了这篇文章", + "Repeated by": "重复" } diff --git a/webapp_likers.py b/webapp_likers.py index 456233a24..7cfe6e8b0 100644 --- a/webapp_likers.py +++ b/webapp_likers.py @@ -40,7 +40,8 @@ def html_likers_of_post(base_dir: str, nickname: str, system_language: str, max_like_count: int, signing_priv_key_pem: str, cw_lists: {}, lists_enabled: str, - boxName: str, default_timeline: str) -> str: + boxName: str, default_timeline: str, + dict_name: str = 'likes') -> str: """Returns html for a screen showing who liked a post """ css_filename = base_dir + '/epicyon-profile.css' @@ -107,17 +108,22 @@ def html_likers_of_post(base_dir: str, nickname: str, obj = post_json_object if has_object_dict(post_json_object): obj = post_json_object['object'] - if not obj.get('likes'): + if not obj.get(dict_name): return None - if not isinstance(obj['likes'], dict): + if not isinstance(obj[dict_name], dict): return None - if not obj['likes'].get('items'): + if not obj[dict_name].get('items'): return None - html_str += '

' + translate['Liked by'] + '

\n' + if dict_name == 'likes': + html_str += \ + '

' + translate['Liked by'] + '

\n' + else: + html_str += \ + '

' + translate['Repeated by'] + '

\n' likers_list = '' - for like_item in obj['likes']['items']: + for like_item in obj[dict_name]['items']: if not like_item.get('actor'): continue liker_actor = like_item['actor']