Skip to content

Commit

Permalink
Fix things related to deleted authors
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymal committed Aug 31, 2023
1 parent 665b604 commit 964ff4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mini_fiction/templates/admin/votes/index.html
Expand Up @@ -29,10 +29,12 @@ <h1>{{ page_title }}</h1>
</td>

<td class="col-user-name">
{% if vote.author %}
{{- user_avatar(vote.author) }}
<a href="{{ url_for('admin_authors.update', pk=vote.author.id) }}">
{{- vote.author.username -}}
</a>
{% else %}N/A{% endif %}
</td>

<td>{{ vote.vote_value }}</td>
Expand Down
3 changes: 2 additions & 1 deletion mini_fiction/templates/includes/chapters_short.html
@@ -1,10 +1,11 @@
{% for chapter in chapters %}
{% set authors = chapter.story.authors -%}
<div class="story-item">
<h3><a href="{{ url_for('chapter.view', story_id=chapter.story.id, chapter_order=chapter.order) }}">{{ chapter.autotitle }}</a></h3>
<p><a href="{{ url_for('story.view', pk=chapter.story.id) }}">{{ chapter.story.title }}</a>
{%- if chapter.story.id in unread_chapters_count and unread_chapters_count[chapter.story.id] > 0 %} (<span class="green" title="{{ _('Unread chapters count') }}">+
{{- unread_chapters_count[chapter.story.id] -}}
</span>){% endif %} {{ pgettext('story_by', 'by') }} <a class="authorlink" href="{{ url_for('author.info', user_id=chapter.story.authors[0].id) }}">{{ chapter.story.authors[0].username }}</a>
</span>){% endif %}{% if authors %} {{ pgettext('story_by', 'by') }} <a class="authorlink" href="{{ url_for('author.info', user_id=chapter.story.authors[0].id) }}">{{ authors[0].username }}</a>{% endif %}
{%- if chapter.first_published_at %} <time datetime="{{ chapter.first_published_at.strftime('%Y-%m-%dT%H:%M:%SZ') }}" title="{{ chapter.first_published_at|datetimeformat(DEFAULT_DATETIME_FORMAT) }}">{{ chapter.first_published_at|timesince }}</time>
{%- endif -%}
</p>
Expand Down
2 changes: 2 additions & 0 deletions mini_fiction/views/editlog.py
Expand Up @@ -93,6 +93,8 @@ def show(editlog_id):
def load_users_for_editlog(edit_log):
user_ids = set()
for item in edit_log:
if item.user is None:
continue
user_ids.add(item.user.id)
item_data = item.data
if 'contributors' in item_data:
Expand Down

0 comments on commit 964ff4b

Please sign in to comment.