2024-04-27 19:45:12 +12: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 18:34:29 +02: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-21 15:44:13 +13:00
{% if content_blocked and content_blocked == '-1' %}
{# do nothing - blocked by keyword filter #}
{% else %}
2024-04-27 19:45:12 +12:00
{% set post_title = post.title.replace('`', "'") %}
2024-06-28 18:34:29 +02: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 }}"
2024-01-21 15:44:13 +13:00
{% if content_blocked %} title="{{ _('Filtered: ') }}{{ content_blocked }}"{% endif %}>
{% if post.image_id %}
2024-04-27 19:45:12 +12:00
< div class = "masonry_thumb" title = "{{ post_title }}" >
2024-04-16 20:59:58 +12:00
{% if post.type == POST_TYPE_LINK or post.type == POST_TYPE_VIDEO %}
2024-01-25 21:18:44 +13:00
{% if post.image.medium_url() %}
2024-03-17 16:22:20 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.image.medium_url() }}"
2024-04-27 19:45:12 +12:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" title="{{ post_title }}"
2024-03-17 16:35:26 +13:00
loading="lazy" width="{{ post.image.width }}" height="{{ post.image.height }}" />< / a >
2024-01-21 16:01:32 +13:00
{% elif post.image.source_url %}
2024-03-17 16:22:20 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.image.source_url }}"
2024-04-27 19:45:12 +12:00
alt="{{ post.title.replace('`', "'") }}" title="{{ post_title }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-21 16:01:32 +13:00
{% else %}
2024-03-17 16:22:20 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.url }}"
2024-04-27 19:45:12 +12:00
alt="{{ post_title }}" title="{{ post_title }}"
2024-03-17 16:09:50 +13:00
loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-21 16:01:32 +13:00
{% endif %}
2024-01-21 15:44:13 +13:00
{% elif post.type == POST_TYPE_IMAGE %}
2024-05-06 15:42:12 +12:00
< a href = "{{ post.image.view_url(resize=True) }}" rel = "nofollow ugc" target = "_blank" > < img src = "{{ post.image.medium_url() }}"
2024-04-27 19:45:12 +12:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" title="{{ post_title }}"
2024-03-17 16:35:26 +13:00
loading="lazy" width="{{ post.image.width }}" height="{{ post.image.height }}" />< / a >
2024-01-21 15:44:13 +13:00
{% else %}
< a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" > < img src = "{{ post.image.thumbnail_url() }}"
2024-03-17 16:22:20 +13:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-21 15:44:13 +13:00
{% endif %}
< / div >
< div class = "masonry_info" >
2024-01-31 20:16:46 +13:00
< 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" >
2024-04-27 19:45:12 +12:00
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" title = "{{ post_title }}" > {{ post_title }}< / a > < / p >
2024-01-31 20:16:46 +13:00
< / 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 >
2024-01-21 15:44:13 +13:00
< / div >
{% else %}
2024-01-21 17:19:39 +13: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 19:45:12 +12:00
< div class = "masonry_thumb" title = "{{ post_title }}" >
2024-03-17 16:09:50 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('View image') }}" > < img src = "{{ post.url }}"
2024-04-27 19:45:12 +12:00
alt="{{ post_title }}" title="{{ post_title }}"
2024-03-17 16:09:50 +13:00
loading="{{ 'lazy' if low_bandwidth else 'eager' }}" />< / a >
2024-01-21 16:09:46 +13:00
< / div >
< div class = "masonry_info" >
2024-01-31 20:16:46 +13: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 19:45:12 +12:00
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" title = "{{ post_title }}" > {{ post_title }}< / a > < / p >
2024-01-31 20:16:46 +13: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-21 16:09:46 +13:00
< / div >
{% else %}
2024-01-21 15:44:13 +13:00
< div class = "masonry_info_no_image" >
2024-04-27 19:45:12 +12:00
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" > {{ post_title }}< / a > < / p >
2024-01-21 15:44:13 +13:00
< / div >
2024-01-21 16:09:46 +13:00
{% endif %}
2024-01-21 15:44:13 +13:00
{% endif %}
< / div >
{% endif %}