Merge pull request #2210 from bookwyrm-social/notification-cw

Show content warning in notification status previews
This commit is contained in:
Mouse Reeve 2022-07-09 13:29:22 -07:00 committed by GitHub
commit 85f811022f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 5 deletions

View file

@ -118,7 +118,7 @@
<div class="notification py-2 {% if notification.id in unread %}is-primary is-light{% else %}has-background-body has-text-muted{% endif %}">
<div class="columns">
<div class="column is-clipped">
{% include 'snippets/status_preview.html' with status=related_status %}
{% include 'notifications/items/status_preview.html' with status=related_status %}
</div>
<div class="column is-narrow has-text-muted">
{{ related_status.published_date|timesince }}

View file

@ -119,7 +119,7 @@
<div class="notification py-2 {% if notification.id in unread %}is-primary is-light{% else %}has-background-body has-text-muted{% endif %}">
<div class="columns">
<div class="column is-clipped">
{% include 'snippets/status_preview.html' with status=related_status %}
{% include 'notifications/items/status_preview.html' with status=related_status %}
</div>
<div class="column is-narrow has-text-muted">
{{ related_status.published_date|timesince }}

View file

@ -51,7 +51,7 @@
<div class="notification py-2 {% if notification.id in unread %}is-primary is-light{% else %}has-background-body has-text-default{% endif %}">
<div class="columns">
<div class="column is-clipped">
{% include 'snippets/status_preview.html' with status=related_status %}
{% include 'notifications/items/status_preview.html' with status=related_status %}
</div>
<div class="column is-narrow has-text-default">
{{ related_status.published_date|timesince }}

View file

@ -54,7 +54,7 @@
<div class="notification py-2 {% if notification.id in unread %}is-primary is-light{% else %}has-background-body has-text-default{% endif %}">
<div class="columns">
<div class="column is-clipped">
{% include 'snippets/status_preview.html' with status=related_status %}
{% include 'notifications/items/status_preview.html' with status=related_status %}
</div>
<div class="column is-narrow has-text-default">
{{ related_status.published_date|timesince }}

View file

@ -1,4 +1,17 @@
{% if status.content %}
{% load i18n %}
{% if status.content_warning %}
{% trans "Content warning" as text %}
<span>
<span class="icon icon-warning is-size-5" title="{{ text }}">
<span class="is-sr-only">{{ text }}</span>
</span>
<a href="{{ status.local_path }}">
{{ status.content_warning }}
</a>
</span>
{% elif status.content %}
<a href="{{ status.local_path }}">
{{ status.content | safe | truncatewords_html:10 }}{% if status.mention_books %} <em>{{ status.mention_books.first.title }}</em>{% endif %}
</a>