Show featured hashtags on profile

main
Bob Mottram 2023-05-03 12:00:46 +01:00
parent c65c44631b
commit d27212a0d4
1 changed files with 13 additions and 5 deletions

View File

@ -269,8 +269,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
add_emoji_to_display_name(session, base_dir, http_prefix, add_emoji_to_display_name(session, base_dir, http_prefix,
nickname, domain, nickname, domain,
profile_description, False, translate) profile_description, False, translate)
profile_description = \ featured_hashtags = get_featured_hashtags_as_html(profile_json)
profile_description + get_featured_hashtags_as_html(profile_json)
outbox_url = None outbox_url = None
if not profile_json.get('outbox'): if not profile_json.get('outbox'):
if debug: if debug:
@ -334,6 +333,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
translate, translate,
display_name, follows_you, display_name, follows_you,
profile_description_short, profile_description_short,
featured_hashtags,
avatar_url, image_url, avatar_url, image_url,
moved_to, profile_json['id'], moved_to, profile_json['id'],
also_known_as, access_keys, also_known_as, access_keys,
@ -470,6 +470,7 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
default_timeline: str, default_timeline: str,
display_name: str, display_name: str,
profile_description_short: str, profile_description_short: str,
featured_hashtags: str,
login_button: str, avatar_url: str, login_button: str, avatar_url: str,
theme: str, moved_to: str, theme: str, moved_to: str,
also_known_as: [], also_known_as: [],
@ -551,13 +552,16 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
other_accounts_html += '</p>\n' other_accounts_html += '</p>\n'
if ctr > 0: if ctr > 0:
html_str += other_accounts_html html_str += other_accounts_html
if featured_hashtags:
featured_hashtags += '\n'
html_str += \ html_str += \
' <a href="/users/' + nickname + \ ' <a href="/users/' + nickname + \
'/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \ '/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \
translate['QR Code'] + '" tabindex="1">' + \ translate['QR Code'] + '" tabindex="1">' + \
'<img class="qrcode" alt="' + translate['QR Code'] + \ '<img class="qrcode" alt="' + translate['QR Code'] + \
'" src="/icons/qrcode.png" /></a></p>\n' + \ '" src="/icons/qrcode.png" /></a></p>\n' + \
' <p>' + profile_description_short + '</p>\n' + login_button ' <p>' + profile_description_short + '</p>\n' + \
featured_hashtags + login_button
if pinned_content: if pinned_content:
html_str += pinned_content.replace('<p>', '<p>📎', 1) html_str += pinned_content.replace('<p>', '<p>📎', 1)
@ -582,6 +586,7 @@ def _get_profile_header_after_search(nickname: str, default_timeline: str,
display_name: str, display_name: str,
follows_you: bool, follows_you: bool,
profile_description_short: str, profile_description_short: str,
featured_hashtags: str,
avatar_url: str, image_url: str, avatar_url: str, image_url: str,
moved_to: str, actor: str, moved_to: str, actor: str,
also_known_as: [], also_known_as: [],
@ -660,8 +665,11 @@ def _get_profile_header_after_search(nickname: str, default_timeline: str,
if ctr > 0: if ctr > 0:
html_str += other_accounts_html html_str += other_accounts_html
if featured_hashtags:
featured_hashtags += '\n'
html_str += \ html_str += \
' <p>' + profile_description_short + '</p>\n' + \ ' <p>' + profile_description_short + '</p>\n' + \
featured_hashtags + \
' </figcaption>\n' + \ ' </figcaption>\n' + \
' </figure>\n\n' ' </figure>\n\n'
return html_str return html_str
@ -739,10 +747,9 @@ def html_profile(signing_priv_key_pem: str,
add_emoji_to_display_name(session, base_dir, http_prefix, add_emoji_to_display_name(session, base_dir, http_prefix,
nickname, domain, nickname, domain,
profile_description, False, translate) profile_description, False, translate)
profile_description = \
profile_description + get_featured_hashtags_as_html(profile_json)
if profile_description: if profile_description:
profile_description = standardize_text(profile_description) profile_description = standardize_text(profile_description)
featured_hashtags = get_featured_hashtags_as_html(profile_json)
posts_button = 'button' posts_button = 'button'
following_button = 'button' following_button = 'button'
moved_button = 'button' moved_button = 'button'
@ -1039,6 +1046,7 @@ def html_profile(signing_priv_key_pem: str,
domain, domain_full, translate, domain, domain_full, translate,
default_timeline, display_name, default_timeline, display_name,
profile_description_short, profile_description_short,
featured_hashtags,
login_button, avatar_url, theme, login_button, avatar_url, theme,
moved_to, also_known_as, moved_to, also_known_as,
pinned_content, access_keys, pinned_content, access_keys,