Skip to content

Commit

Permalink
populate user_url for mastodon
Browse files Browse the repository at this point in the history
  • Loading branch information
facundoolano committed Jun 24, 2024
1 parent 3fe795f commit 4a6f687
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion feedi/parsers/mastodon.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def fetch_toots(server_url, access_token, newer_than=None, limit=None):

if toot.get('reblog'):
reblogged_by = display_name(toot)
entry['header'] = f'<i class="fas fa-retweet"></i> { reblogged_by } boosted'
entry['header'] = f'<i class="fas fa-retweet"></i> {reblogged_by} boosted'
toot = toot['reblog']

entry['avatar_url'] = toot['account']['avatar']
Expand All @@ -87,6 +87,7 @@ def fetch_toots(server_url, access_token, newer_than=None, limit=None):
# use server-local urls
entry['target_url'] = status_url(server_url, toot)
entry['comments_url'] = entry['target_url']
entry['user_url'] = user_url(server_url, toot)

# for media we only support images for now and will take just the first one
media = [m['preview_url'] for m in toot['media_attachments'] if m['type'] == 'image']
Expand Down
2 changes: 1 addition & 1 deletion feedi/templates/entry_avatar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if entry.avatar_url %}
<a href="{{ url_for('entry_list', username=entry.username ) }}">
<a href="{{ entry.user_url or url_for('entry_list', username=entry.username ) }}">
<img class="is-rounded feed-avatar" src="{{ entry.avatar_url }}" alt="{{ entry.username }}" title="{{ entry.username }}">
</a>
{% elif entry.feed %}
Expand Down
2 changes: 1 addition & 1 deletion feedi/templates/entry_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% if entry.target_url %}href="{{ entry.target_url }}" target="_blank"{% endif %}
>{{ entry.title | safe }}</a>
{% elif entry.has_distinct_user %}
<a href="{{ url_for('entry_list', username=entry.username ) }}">
<a href="{{ entry.user_url or url_for('entry_list', username=entry.username ) }}">
{{ entry.display_name or entry.username }}
</a>
{% else %}
Expand Down

0 comments on commit 4a6f687

Please sign in to comment.