Show featured hashtags within edit profile screen

merge-requests/30/head
Bob Mottram 2023-05-02 22:51:30 +01:00
parent 45e6d291b4
commit 4385028bde
27 changed files with 103 additions and 30 deletions

View File

@ -621,5 +621,6 @@
"Import Blocks": "استيراد مثيلات محظورة", "Import Blocks": "استيراد مثيلات محظورة",
"Export Blocks": "تصدير المثيلات المحظورة", "Export Blocks": "تصدير المثيلات المحظورة",
"Transcript": "نص", "Transcript": "نص",
"Show vote posts": "إظهار مشاركات التصويت" "Show vote posts": "إظهار مشاركات التصويت",
"Featured hashtags": "علامات التجزئة المميزة"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "অবরুদ্ধ দৃষ্টান্ত আমদানি করুন", "Import Blocks": "অবরুদ্ধ দৃষ্টান্ত আমদানি করুন",
"Export Blocks": "অবরুদ্ধ দৃষ্টান্ত রপ্তানি করুন", "Export Blocks": "অবরুদ্ধ দৃষ্টান্ত রপ্তানি করুন",
"Transcript": "প্রতিলিপি", "Transcript": "প্রতিলিপি",
"Show vote posts": "ভোট পোস্ট দেখান" "Show vote posts": "ভোট পোস্ট দেখান",
"Featured hashtags": "বৈশিষ্ট্যযুক্ত হ্যাশট্যাগ"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Importa instàncies bloquejades", "Import Blocks": "Importa instàncies bloquejades",
"Export Blocks": "Exporta instàncies bloquejades", "Export Blocks": "Exporta instàncies bloquejades",
"Transcript": "Transcripció", "Transcript": "Transcripció",
"Show vote posts": "Mostra les publicacions de vot" "Show vote posts": "Mostra les publicacions de vot",
"Featured hashtags": "Hashtags destacats"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Mewnforio Achosion wedi'u Rhwystro", "Import Blocks": "Mewnforio Achosion wedi'u Rhwystro",
"Export Blocks": "Allforio Achosion wedi'u Rhwystro", "Export Blocks": "Allforio Achosion wedi'u Rhwystro",
"Transcript": "Trawsgrifiad", "Transcript": "Trawsgrifiad",
"Show vote posts": "Dangos postiadau pleidlais" "Show vote posts": "Dangos postiadau pleidlais",
"Featured hashtags": "Hashtags dan sylw"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Blockierte Instanzen importieren", "Import Blocks": "Blockierte Instanzen importieren",
"Export Blocks": "Blockierte Instanzen exportieren", "Export Blocks": "Blockierte Instanzen exportieren",
"Transcript": "Abschrift", "Transcript": "Abschrift",
"Show vote posts": "Abstimmungsbeiträge anzeigen" "Show vote posts": "Abstimmungsbeiträge anzeigen",
"Featured hashtags": "Ausgewählte Hashtags"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Εισαγωγή αποκλεισμένων παρουσιών", "Import Blocks": "Εισαγωγή αποκλεισμένων παρουσιών",
"Export Blocks": "Εξαγωγή αποκλεισμένων παρουσιών", "Export Blocks": "Εξαγωγή αποκλεισμένων παρουσιών",
"Transcript": "Αντίγραφο", "Transcript": "Αντίγραφο",
"Show vote posts": "Εμφάνιση ψηφοφοριακών αναρτήσεων" "Show vote posts": "Εμφάνιση ψηφοφοριακών αναρτήσεων",
"Featured hashtags": "Επιλεγμένα hashtag"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Import Blocks", "Import Blocks": "Import Blocks",
"Export Blocks": "Export Blocks", "Export Blocks": "Export Blocks",
"Transcript": "Transcript", "Transcript": "Transcript",
"Show vote posts": "Show vote posts" "Show vote posts": "Show vote posts",
"Featured hashtags": "Featured hashtags"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Importar instancias bloqueadas", "Import Blocks": "Importar instancias bloqueadas",
"Export Blocks": "Exportar instancias bloqueadas", "Export Blocks": "Exportar instancias bloqueadas",
"Transcript": "Transcripción", "Transcript": "Transcripción",
"Show vote posts": "Mostrar publicaciones de votos" "Show vote posts": "Mostrar publicaciones de votos",
"Featured hashtags": "Hashtags destacados"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "وارد کردن موارد مسدود شده", "Import Blocks": "وارد کردن موارد مسدود شده",
"Export Blocks": "نمونه های مسدود شده را صادر کنید", "Export Blocks": "نمونه های مسدود شده را صادر کنید",
"Transcript": "رونوشت", "Transcript": "رونوشت",
"Show vote posts": "نمایش پست های رای" "Show vote posts": "نمایش پست های رای",
"Featured hashtags": "هشتگ های ویژه"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Importer des instances bloquées", "Import Blocks": "Importer des instances bloquées",
"Export Blocks": "Exporter les instances bloquées", "Export Blocks": "Exporter les instances bloquées",
"Transcript": "Transcription", "Transcript": "Transcription",
"Show vote posts": "Afficher les messages de vote" "Show vote posts": "Afficher les messages de vote",
"Featured hashtags": "Mots-clics en vedette"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Iompórtáil Cásanna Blocáilte", "Import Blocks": "Iompórtáil Cásanna Blocáilte",
"Export Blocks": "Easpórtáil Cásanna Blocáilte", "Export Blocks": "Easpórtáil Cásanna Blocáilte",
"Transcript": "Athscríbhinn", "Transcript": "Athscríbhinn",
"Show vote posts": "Taispeáin postálacha vótaí" "Show vote posts": "Taispeáin postálacha vótaí",
"Featured hashtags": "Hashtags faoi thrácht"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "अवरोधित उदाहरण आयात करें", "Import Blocks": "अवरोधित उदाहरण आयात करें",
"Export Blocks": "निर्यात अवरुद्ध उदाहरण", "Export Blocks": "निर्यात अवरुद्ध उदाहरण",
"Transcript": "प्रतिलिपि", "Transcript": "प्रतिलिपि",
"Show vote posts": "वोट पोस्ट दिखाएं" "Show vote posts": "वोट पोस्ट दिखाएं",
"Featured hashtags": "विशेष रुप से प्रदर्शित हैशटैग"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Importa istanze bloccate", "Import Blocks": "Importa istanze bloccate",
"Export Blocks": "Esporta istanze bloccate", "Export Blocks": "Esporta istanze bloccate",
"Transcript": "Trascrizione", "Transcript": "Trascrizione",
"Show vote posts": "Mostra messaggi di voto" "Show vote posts": "Mostra messaggi di voto",
"Featured hashtags": "Hashtag in primo piano"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "ブロックされたインスタンスのインポート", "Import Blocks": "ブロックされたインスタンスのインポート",
"Export Blocks": "ブロックされたインスタンスのエクスポート", "Export Blocks": "ブロックされたインスタンスのエクスポート",
"Transcript": "成績証明書", "Transcript": "成績証明書",
"Show vote posts": "投票投稿を表示" "Show vote posts": "投票投稿を表示",
"Featured hashtags": "注目のハッシュタグ"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "차단된 인스턴스 가져오기", "Import Blocks": "차단된 인스턴스 가져오기",
"Export Blocks": "차단된 인스턴스 내보내기", "Export Blocks": "차단된 인스턴스 내보내기",
"Transcript": "성적 증명서", "Transcript": "성적 증명서",
"Show vote posts": "투표 게시물 표시" "Show vote posts": "투표 게시물 표시",
"Featured hashtags": "추천 해시태그"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Mînakên Astengkirî Import", "Import Blocks": "Mînakên Astengkirî Import",
"Export Blocks": "Mînakên Astengkirî Export", "Export Blocks": "Mînakên Astengkirî Export",
"Transcript": "Transcript", "Transcript": "Transcript",
"Show vote posts": "Mesajên dengdanê nîşan bide" "Show vote posts": "Mesajên dengdanê nîşan bide",
"Featured hashtags": "Hashtagên taybetmendî"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Importeer geblokkeerde instanties", "Import Blocks": "Importeer geblokkeerde instanties",
"Export Blocks": "Exporteer geblokkeerde instanties", "Export Blocks": "Exporteer geblokkeerde instanties",
"Transcript": "Vertaling", "Transcript": "Vertaling",
"Show vote posts": "Toon stemberichten" "Show vote posts": "Toon stemberichten",
"Featured hashtags": "Aanbevolen hashtags"
} }

View File

@ -617,5 +617,6 @@
"Import Blocks": "Import Blocks", "Import Blocks": "Import Blocks",
"Export Blocks": "Export Blocks", "Export Blocks": "Export Blocks",
"Transcript": "Transcript", "Transcript": "Transcript",
"Show vote posts": "Show vote posts" "Show vote posts": "Show vote posts",
"Featured hashtags": "Featured hashtags"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Importuj zablokowane instancje", "Import Blocks": "Importuj zablokowane instancje",
"Export Blocks": "Eksportuj zablokowane instancje", "Export Blocks": "Eksportuj zablokowane instancje",
"Transcript": "Transkrypcja", "Transcript": "Transkrypcja",
"Show vote posts": "Pokaż posty z głosowaniem" "Show vote posts": "Pokaż posty z głosowaniem",
"Featured hashtags": "Polecane hashtagi"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Importar instâncias bloqueadas", "Import Blocks": "Importar instâncias bloqueadas",
"Export Blocks": "Exportar instâncias bloqueadas", "Export Blocks": "Exportar instâncias bloqueadas",
"Transcript": "Transcrição", "Transcript": "Transcrição",
"Show vote posts": "Mostrar postagens de votação" "Show vote posts": "Mostrar postagens de votação",
"Featured hashtags": "Hashtags em destaque"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Импорт заблокированных экземпляров", "Import Blocks": "Импорт заблокированных экземпляров",
"Export Blocks": "Экспорт заблокированных экземпляров", "Export Blocks": "Экспорт заблокированных экземпляров",
"Transcript": "Стенограмма", "Transcript": "Стенограмма",
"Show vote posts": "Показать сообщения для голосования" "Show vote posts": "Показать сообщения для голосования",
"Featured hashtags": "Избранные хэштеги"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Ingiza Matukio Yaliyozuiwa", "Import Blocks": "Ingiza Matukio Yaliyozuiwa",
"Export Blocks": "Hamisha Matukio Yaliyozuiwa", "Export Blocks": "Hamisha Matukio Yaliyozuiwa",
"Transcript": "Nakala", "Transcript": "Nakala",
"Show vote posts": "Onyesha machapisho ya kura" "Show vote posts": "Onyesha machapisho ya kura",
"Featured hashtags": "Reli zilizoangaziwa"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Engellenen Örnekleri İçe Aktar", "Import Blocks": "Engellenen Örnekleri İçe Aktar",
"Export Blocks": "Engellenen Örnekleri Dışa Aktar", "Export Blocks": "Engellenen Örnekleri Dışa Aktar",
"Transcript": "Deşifre metni", "Transcript": "Deşifre metni",
"Show vote posts": "Oy gönderilerini göster" "Show vote posts": "Oy gönderilerini göster",
"Featured hashtags": "Öne çıkan etiketler"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "Імпортувати заблоковані екземпляри", "Import Blocks": "Імпортувати заблоковані екземпляри",
"Export Blocks": "Експортувати заблоковані екземпляри", "Export Blocks": "Експортувати заблоковані екземпляри",
"Transcript": "Стенограма", "Transcript": "Стенограма",
"Show vote posts": "Показати повідомлення про голосування" "Show vote posts": "Показати повідомлення про голосування",
"Featured hashtags": "Рекомендовані хештеги"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "ימפּאָרט בלאַקט ינסטאַנסיז", "Import Blocks": "ימפּאָרט בלאַקט ינסטאַנסיז",
"Export Blocks": "עקספּאָרט בלאַקט ינסטאַנסיז", "Export Blocks": "עקספּאָרט בלאַקט ינסטאַנסיז",
"Transcript": "טראַנסקריפּט", "Transcript": "טראַנסקריפּט",
"Show vote posts": "ווייַזן שטימען אַרטיקלען" "Show vote posts": "ווייַזן שטימען אַרטיקלען",
"Featured hashtags": "פֿעיִקייטן פון hashtags"
} }

View File

@ -621,5 +621,6 @@
"Import Blocks": "导入被阻止的实例", "Import Blocks": "导入被阻止的实例",
"Export Blocks": "导出被阻止的实例", "Export Blocks": "导出被阻止的实例",
"Transcript": "成绩单", "Transcript": "成绩单",
"Show vote posts": "显示投票帖子" "Show vote posts": "显示投票帖子",
"Featured hashtags": "特色标签"
} }

View File

@ -10,6 +10,7 @@ __module_group__ = "Web Interface"
import os import os
from pprint import pprint from pprint import pprint
from webfinger import webfinger_handle from webfinger import webfinger_handle
from utils import valid_hash_tag
from utils import remove_id_ending from utils import remove_id_ending
from utils import standardize_text from utils import standardize_text
from utils import get_display_name from utils import get_display_name
@ -2437,7 +2438,8 @@ def _html_edit_profile_main(base_dir: str, display_nickname: str, bio_str: str,
gemini_link: str, blog_address: str, gemini_link: str, blog_address: str,
actor_json: {}, translate: {}, actor_json: {}, translate: {},
nickname: str, domain: str, nickname: str, domain: str,
max_recent_posts: int) -> str: max_recent_posts: int,
featured_hashtags: str) -> str:
"""main info on edit profile screen """main info on edit profile screen
""" """
image_formats = get_image_formats() image_formats = get_image_formats()
@ -2452,6 +2454,10 @@ def _html_edit_profile_main(base_dir: str, display_nickname: str, bio_str: str,
edit_text_area(translate['Your bio'], None, 'bio', bio_str, edit_text_area(translate['Your bio'], None, 'bio', bio_str,
200, '', True) 200, '', True)
edit_profile_form += \
edit_text_field(translate['Featured hashtags'], 'featuredHashtags',
featured_hashtags, '#tag1 #tag2')
edit_profile_form += \ edit_profile_form += \
' <label class="labels">' + translate['Avatar image'] + \ ' <label class="labels">' + translate['Avatar image'] + \
'</label>\n' + \ '</label>\n' + \
@ -2570,6 +2576,45 @@ def _html_edit_profile_top_banner(base_dir: str,
return edit_profile_form return edit_profile_form
def _get_featured_hashtags(actor_json: {}) -> str:
"""returns a string containing featured hashtags
"""
result = ''
if not actor_json.get('tag'):
return result
if not isinstance(actor_json['tag'], list):
return result
for tag_dict in actor_json['tag']:
if not tag_dict.get('type'):
continue
if not isinstance(tag_dict['type'], str):
continue
if not tag_dict['type'].endswith('Hashtag'):
continue
if not tag_dict.get('name'):
continue
if not isinstance(tag_dict['name'], str):
continue
if not tag_dict.get('href'):
continue
if not isinstance(tag_dict['href'], str):
continue
tag_name = tag_dict['name']
if not tag_name:
continue
if tag_name.startswith('#'):
tag_name = tag_name[1:]
if not tag_name:
continue
tag_url = tag_dict['href']
if '://' not in tag_url or '.' not in tag_url:
continue
if not valid_hash_tag(tag_name):
continue
result += '#' + tag_name + ' '
return result.strip()
def html_edit_profile(server, translate: {}, def html_edit_profile(server, translate: {},
base_dir: str, path: str, base_dir: str, path: str,
domain: str, port: int, domain: str, port: int,
@ -2612,8 +2657,8 @@ def html_edit_profile(server, translate: {},
notify_likes = notify_reactions = '' notify_likes = notify_reactions = ''
hide_like_button = hide_reaction_button = media_instance_str = '' hide_like_button = hide_reaction_button = media_instance_str = ''
blogs_instance_str = news_instance_str = moved_to = twitter_str = '' blogs_instance_str = news_instance_str = moved_to = twitter_str = ''
bio_str = donate_url = website_url = gemini_link = email_address = '' bio_str = donate_url = website_url = gemini_link = ''
pgp_pub_key = enigma_pub_key = '' email_address = featured_hashtags = pgp_pub_key = enigma_pub_key = ''
pgp_fingerprint = xmpp_address = matrix_address = '' pgp_fingerprint = xmpp_address = matrix_address = ''
ssb_address = blog_address = tox_address = '' ssb_address = blog_address = tox_address = ''
cwtch_address = briar_address = '' cwtch_address = briar_address = ''
@ -2623,6 +2668,7 @@ def html_edit_profile(server, translate: {},
if actor_json: if actor_json:
if actor_json.get('movedTo'): if actor_json.get('movedTo'):
moved_to = actor_json['movedTo'] moved_to = actor_json['movedTo']
featured_hashtags = _get_featured_hashtags(actor_json)
donate_url = get_donation_url(actor_json) donate_url = get_donation_url(actor_json)
website_url = get_website(actor_json, translate) website_url = get_website(actor_json, translate)
gemini_link = get_gemini_link(actor_json, translate) gemini_link = get_gemini_link(actor_json, translate)
@ -2769,7 +2815,8 @@ def html_edit_profile(server, translate: {},
moved_to, donate_url, website_url, moved_to, donate_url, website_url,
gemini_link, gemini_link,
blog_address, actor_json, translate, blog_address, actor_json, translate,
nickname, domain, max_recent_posts) nickname, domain, max_recent_posts,
featured_hashtags)
# whether to show votes # whether to show votes
show_vote_posts = True show_vote_posts = True