Merge pull request #71 from cyisfor/preview_sensitive

Preview sensitive media
This commit is contained in:
GCU Prosthetic Conscience 2020-06-01 10:15:25 -04:00 committed by GitHub
commit a536c35dfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -50,6 +50,11 @@ class Preference(models.Model):
timezone = models.CharField( timezone = models.CharField(
max_length=80, blank=True, null=True, choices=timezones, default="UTC" max_length=80, blank=True, null=True, choices=timezones, default="UTC"
) )
preview_sensitive = models.BooleanField(
default=False,
help_text=_(
'Show preview for media marked as "sensitive"'))
no_javascript = models.BooleanField( no_javascript = models.BooleanField(
default=False, default=False,
help_text=_( help_text=_(

View File

@ -101,7 +101,7 @@
<figure class="column attachment-image"> <figure class="column attachment-image">
<a href="{{ media.url }}"> <a href="{{ media.url }}">
<noscript class="loading-lazy"> <noscript class="loading-lazy">
{% if toot.sensitive %} {% if toot.sensitive and not preferences.preview_sensitive %}
<img loading="lazy" src="{% static "images/sensitive.png" %}" <img loading="lazy" src="{% static "images/sensitive.png" %}"
{% else %} {% else %}
<img loading="lazy" src="{{ media.preview_url }}" <img loading="lazy" src="{{ media.preview_url }}"
@ -127,7 +127,7 @@
<source src="{{ media.url }}" type="video/mp4"> <source src="{{ media.url }}" type="video/mp4">
<a href="{{ media.url }}"> <a href="{{ media.url }}">
<noscript class="loading-lazy"> <noscript class="loading-lazy">
{% if toot.sensitive %} {% if toot.sensitive and not preferences.preview_sensitive %}
<img loading="lazy" src="{% static "images/sensitive.png" %}" <img loading="lazy" src="{% static "images/sensitive.png" %}"
{% else %} {% else %}
<img loading="lazy" src="{{ media.preview_url }}" <img loading="lazy" src="{{ media.preview_url }}"

View File

@ -30,6 +30,15 @@
</div> </div>
</div> </div>
<h2 class="subtitle">Options</h2>
<div class="columns">
<div class="column is-quarter">
<label class="label checkbox" for="id_preview_sensitive">
{% render_field form.preview_sensitive class+="checkbox" %}
{{ form.preview_sensitive.label }}
</label>
</div>
</div>
<h2 class="subtitle">Timeline Options</h2> <h2 class="subtitle">Timeline Options</h2>
<div class="field"> <div class="field">
<label class="label checkbox"> <label class="label checkbox">