Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not automatically show media previews of nsfw posts #300

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions templates/components/entry.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{%- set SHOW_PREVIEW = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_PREVIEW'), 'false') -%}
{%- set SHOW_THUMBNAILS = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_THUMBNAILS'), 'true') -%}
{%- set SHOW_USER_AVATARS = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_USERS_AVATARS'), 'true') -%}
{%- set SHOW_MAGAZINE_ICONS = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_MAGAZINES_ICONS'), 'true') -%}

{% if not app.user or (app.user and not app.user.isBlocked(entry.user)) %}
{% if entry.visibility is same as 'private' and (not app.user or not app.user.isFollower(entry.user)) %}
<div class="section section--small"
Expand All @@ -9,9 +14,9 @@
{% else %}
<article{{ attributes.defaults({
class: html_classes('entry section subject', {
'no-image': app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_THUMBNAILS')) is same as 'false',
'no-image': SHOW_THUMBNAILS is same as 'false',
'own': app.user and entry.isAuthor(app.user),
'show-preview': app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_PREVIEW')) is same as 'true'
'show-preview': SHOW_PREVIEW is same as 'true' and not entry.isAdult
})}).without('id') }}
id="entry-{{ entry.id }}"
data-controller="subject preview mentions"
Expand Down Expand Up @@ -69,15 +74,15 @@
{% endif %}
{% endif %}
<aside class="meta entry__meta">
<span>{{ component('user_inline', {user: entry.user, showAvatar: app.request.cookies.has(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_USERS_AVATARS')) == false or app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_USERS_AVATARS')) is same as 'true'}) -}}</span>
<span>{{ component('user_inline', {user: entry.user, showAvatar: SHOW_USER_AVATARS is same as 'true'}) -}}</span>
<span>,</span>
<span>{{ component('date', {date: entry.createdAt}) }}</span>
<span>{{ component('date_edited', {createdAt: entry.createdAt, editedAt: entry.editedAt}) }}</span>
{% if showMagazineName %}
<span>{{ 'to'|trans }} {{ component('magazine_inline', {magazine: entry.magazine, showAvatar: app.request.cookies.has(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_MAGAZINES_ICONS')) == false or app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_MAGAZINES_ICONS')) is same as 'true'}) }}</span>
<span>{{ 'to'|trans }} {{ component('magazine_inline', {magazine: entry.magazine, showAvatar: SHOW_MAGAZINE_ICONS is same as 'true'}) }}</span>
{% endif %}
</aside>
{% if not app.request.cookies.has(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_THUMBNAILS')) or app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_THUMBNAILS')) is same as 'true' %}
{% if SHOW_THUMBNAILS is same as 'true' %}
{% if entry.image %}
{% if entry.type is same as 'link' or entry.type is same as 'video' %}
<figure>
Expand Down
10 changes: 7 additions & 3 deletions templates/components/entry_comment.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{%- set SHOW_PREVIEW = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_PREVIEW'), 'false') -%}
{%- set DYNAMIC_LISTS = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_GENERAL_DYNAMIC_LISTS'), 'false') -%}
{%- set VIEW_STYLE = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::ENTRY_COMMENTS_VIEW'), 'tree') -%}

{% if not app.user or (app.user and not app.user.isBlocked(comment.user)) %}
{% if comment.visibility is same as 'private' and (not app.user or not app.user.isFollower(comment.user)) %}
<div class="section section--small {{ 'comment-level--' ~ this.getLevel() }}"
Expand All @@ -9,12 +13,12 @@
class: html_classes('section comment entry-comment subject ' ~ 'comment-level--' ~ this.getLevel(),{
'own': app.user and comment.isAuthor(app.user),
'author': comment.isAuthor(comment.entry.user),
'show-preview': app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_ENTRIES_SHOW_PREVIEW')) is same as 'true',
'show-preview': SHOW_PREVIEW is same as 'true' and not comment.isAdult
})}).without('id') }}
id="entry-comment-{{ comment.id }}"
data-controller="comment subject mentions"
data-subject-parent-value="{{ comment.parent ? comment.parent.id : '' }}"
data-action="{{- app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_GENERAL_DYNAMIC_LISTS')) is same as 'true' ? 'notifications:Notification@window->subject#notification' : '' -}}">
data-action="{{- DYNAMIC_LISTS is same as 'true' ? 'notifications:Notification@window->subject#notification' : '' -}}">
<header>
{% if comment.isAdult %}<span class="badge danger">18+</span>{% endif %}
{{ component('user_inline', {user: comment.user, showAvatar: false}) }}
Expand Down Expand Up @@ -131,7 +135,7 @@
comment: comment,
level: level,
showNested: true,
view: app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::ENTRY_COMMENTS_VIEW'), 'tree')
view: VIEW_STYLE
}) }}
{% endif %}
{% endif %}
4 changes: 3 additions & 1 deletion templates/components/post.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{%- set SHOW_PREVIEW = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_POSTS_SHOW_PREVIEW'), 'false') -%}

{% if not app.user or (app.user and not app.user.isBlocked(post.user)) %}
{% if post.visibility is same as 'private' and (not app.user or not app.user.isFollower(post.user)) %}
<div class="section section--small"
Expand All @@ -8,7 +10,7 @@
<blockquote{{ attributes.defaults({
class: html_classes('section post subject ', {
'own': app.user and post.isAuthor(app.user),
'show-preview': app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_POSTS_SHOW_PREVIEW')) is same as 'true'
'show-preview': SHOW_PREVIEW is same as 'true' and not post.isAdult
})}).without('id') }}
id="post-{{ post.id }}"
data-controller="post subject mentions"
Expand Down
7 changes: 5 additions & 2 deletions templates/components/post_comment.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{%- set SHOW_PREVIEW = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_POSTS_SHOW_PREVIEW'), 'false') -%}
{%- set VIEW_STYLE = app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::POST_COMMENTS_VIEW'), 'tree') -%}

{% if withPost %}
{{ component('post', {post: comment.post}) }}
{% endif %}
Expand All @@ -12,7 +15,7 @@
class: html_classes('section comment post-comment subject ' ~ 'comment-level--' ~ this.getLevel(),{
'own': app.user and comment.isAuthor(app.user),
'author': comment.isAuthor(comment.post.user),
'show-preview': app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::KBIN_POSTS_SHOW_PREVIEW')) is same as 'true'
'show-preview': SHOW_PREVIEW is same as 'true' and not comment.isAdult
})}).without('id') }}
id="post-comment-{{ comment.id }}"
data-controller="comment subject mentions"
Expand Down Expand Up @@ -139,7 +142,7 @@
comment: comment,
level: level,
showNested: true,
view: app.request.cookies.get(constant('App\\Controller\\User\\ThemeSettingsController::POST_COMMENTS_VIEW'), 'tree')
view: VIEW_STYLE
e-five256 marked this conversation as resolved.
Show resolved Hide resolved
}) }}
{% endif %}
{% endif %}