2024-04-27 00:45:12 -07:00
{# do not use any back ticks in the HTML produced by this template - javascript needs to load it as a string. See community.html #}
2024-06-28 09:34:29 -07:00
{% set content_blocked = post.blocked_by_content_filter(content_filters)
or (current_user.hide_nsfw == 3 and post.nsfw)
or (current_user.hide_nsfl == 3 and post.nsfl)
or (current_user.ignore_bots == 3 and post.from_bot) -%}
{% set blur_content = (current_user.hide_nsfw == 2 and post.nsfw)
or (current_user.hide_nsfl == 2 and post.nsfl)
or (current_user.ignore_bots == 2 and post.from_bot) -%}
2024-01-20 18:44:13 -08:00
{% if content_blocked and content_blocked == '-1' %}
{# do nothing - blocked by keyword filter #}
{% else %}
2024-04-27 00:45:12 -07:00
{% set post_title = post.title.replace('`', "'") %}
2024-06-28 09:34:29 -07:00
< div class = "item{{ ' reported' if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator() }}{{ ' blocked' if content_blocked }}{{ ' blur' if blur_content }}"
2025-01-13 07:35:02 -08:00
{% if content_blocked %} title="{{ _('Filtered: ') }}{{ content_blocked }}"{% endif %} id="post_{{ post.id }}">
2024-12-11 14:53:58 -08:00
{% if post.image_id and not (post.url and (post.url.endswith('.mp4') or post.url.endswith('.webm'))) %}
2024-04-27 00:45:12 -07:00
< div class = "masonry_thumb" title = "{{ post_title }}" >
2024-04-16 01:59:58 -07:00
{% if post.type == POST_TYPE_LINK or post.type == POST_TYPE_VIDEO %}
2024-01-25 00:18:44 -08:00
{% if post.image.medium_url() %}
2024-03-16 20:22:20 -07:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.image.medium_url() }}"
2024-04-27 00:45:12 -07:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" title="{{ post_title }}"
2024-03-16 20:35:26 -07:00
loading="lazy" width="{{ post.image.width }}" height="{{ post.image.height }}" />< / a >
2024-01-20 19:01:32 -08:00
{% elif post.image.source_url %}
2024-03-16 20:22:20 -07:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.image.source_url }}"
2024-04-27 00:45:12 -07:00
alt="{{ post.title.replace('`', "'") }}" title="{{ post_title }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-20 19:01:32 -08:00
{% else %}
2024-03-16 20:22:20 -07:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.url }}"
2024-04-27 00:45:12 -07:00
alt="{{ post_title }}" title="{{ post_title }}"
2024-03-16 20:09:50 -07:00
loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-20 19:01:32 -08:00
{% endif %}
2024-01-20 18:44:13 -08:00
{% elif post.type == POST_TYPE_IMAGE %}
2024-05-05 20:42:12 -07:00
< a href = "{{ post.image.view_url(resize=True) }}" rel = "nofollow ugc" target = "_blank" > < img src = "{{ post.image.medium_url() }}"
2024-04-27 00:45:12 -07:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" title="{{ post_title }}"
2024-03-16 20:35:26 -07:00
loading="lazy" width="{{ post.image.width }}" height="{{ post.image.height }}" />< / a >
2024-01-20 18:44:13 -08:00
{% else %}
< a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" > < img src = "{{ post.image.thumbnail_url() }}"
2024-03-16 20:22:20 -07:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-20 18:44:13 -08:00
{% endif %}
< / div >
{% else %}
2024-01-20 20:19:39 -08:00
{% if post.url and (post.url.endswith('.jpg') or post.url.endswith('.webp') or post.url.endswith('.png') or post.url.endswith('.gif') or post.url.endswith('.avif') or post.url.endswith('.jpeg')) %}
2024-04-27 00:45:12 -07:00
< div class = "masonry_thumb" title = "{{ post_title }}" >
2024-03-16 20:09:50 -07:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.url }}"
2024-04-27 00:45:12 -07:00
alt="{{ post_title }}" title="{{ post_title }}"
2024-03-16 20:09:50 -07:00
loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-20 19:09:46 -08:00
< / div >
< div class = "masonry_info" >
2024-01-30 23:16:46 -08:00
< div class = "row" >
< div class = "col col-2" >
{% include "post/_post_voting_buttons_masonry.html" %}
< / div >
< div class = "col col-8" >
2024-04-27 00:45:12 -07:00
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" title = "{{ post_title }}" > {{ post_title }}< / a > < / p >
2024-01-30 23:16:46 -08:00
< / div >
< div class = "col col-2 reply_col" >
< a href = "{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None, _anchor='post_replies') }}" aria-label = "{{ _('View comments') }}" aria-hidden = "true" > < span class = "fe fe-reply" > < / span > < / a >
{% if post.reply_count %}< a href = "{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None, _anchor='post_replies') }}" aria-label = "{{ _('View comments') }}" > {{ post.reply_count }}< / a > {% endif %}
< / div >
< / div >
2024-01-20 19:09:46 -08:00
< / div >
2024-12-11 14:53:58 -08:00
{% elif post.url and (post.url.endswith('.mp4') or post.url.endswith('.webm')) -%}
< div class = "masonry_thumb" title = "{{ post_title }}" >
< video class = "responsive-video" controls preload = "auto" { { ' autoplay muted ' if autoplay } } { { ' loop ' if post . community . loop_videos ( ) } } >
{% if post.url.endswith('.mp4') -%}
< source src = "{{ post.url }}" type = "video/mp4" / >
{% elif post.url.endswith('.webm') -%}
< source src = "{{ post.url }}" type = "video/webm" / >
{% endif -%}
< / video >
< / div >
2024-01-20 19:09:46 -08:00
{% else %}
2024-01-20 18:44:13 -08:00
< div class = "masonry_info_no_image" >
2024-12-11 14:53:58 -08:00
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" > < / a > < / p >
2024-01-20 18:44:13 -08:00
< / div >
2024-01-20 19:09:46 -08:00
{% endif %}
2024-01-20 18:44:13 -08:00
{% endif %}
2024-12-11 14:53:58 -08:00
< div class = "masonry_info" >
< div class = "row" >
< div class = "col col-3" >
< div class = "voting_buttons_masonry" >
{% include "post/_post_voting_buttons_masonry.html" %}
< / div >
< / div >
< div class = "col col-8" >
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" title = "{{ post_title }}" > {{ post_title }}< / a > < / p >
< / div >
< div class = "col col-1 reply_col" >
< a href = "{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None, _anchor='post_replies') }}" aria-label = "{{ _('View comments') }}" aria-hidden = "true" > < span class = "fe fe-reply" > < / span > < / a >
{% if post.reply_count %}< a href = "{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None, _anchor='post_replies') }}" aria-label = "{{ _('View comments') }}" > {{ post.reply_count }}< / a > {% endif %}
< / div >
< / div >
< / div >
2024-01-20 18:44:13 -08:00
< / div >
{% endif %}