2024-01-21 15:44:13 +13:00
{% set content_blocked = post.blocked_by_content_filter(content_filters) %}
{% if content_blocked and content_blocked == '-1' %}
{# do nothing - blocked by keyword filter #}
{% else %}
< div class = "post_teaser{{ ' reported' if post.reports and current_user.is_authenticated and post.community.is_moderator() }}{{ ' blocked' if content_blocked }}"
{% if content_blocked %} title="{{ _('Filtered: ') }}{{ content_blocked }}"{% endif %}>
{% if post.image_id %}
{% if post_layout == 'masonry' or low_bandwidth %}
{% set thumbnail = post.image.thumbnail_url() %}
{% elif post_layout == 'masonry_wide' %}
{% set thumbnail = post.image.view_url() %}
{% endif %}
2024-01-21 17:05:46 +13:00
< div class = "masonry_thumb" title = "{{ post.title }}" >
2024-01-21 15:44:13 +13:00
{% if post.type == POST_TYPE_LINK %}
2024-01-25 21:18:44 +13:00
{% if post.image.medium_url() %}
2024-03-17 12:36:07 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" data-fslightbox data-type = "image" aria-label = "{{ _('View image') }}" > < img src = "{{ post.image.medium_url() }}"
2024-03-16 00:09:11 +00:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" 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 12:36:07 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" data-fslightbox data-type = "image" aria-label = "{{ _('View image') }}" > < img src = "{{ post.image.source_url }}"
2024-01-21 16:01:32 +13:00
alt="{{ post.title }}" loading="lazy" />< / a >
{% else %}
2024-03-17 12:36:07 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" data-fslightbox data-type = "image" aria-label = "{{ _('View image') }}" > < img src = "{{ post.url }}"
2024-01-21 17:05:46 +13:00
alt="{{ post.title }}" 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-03-17 12:36:07 +13:00
< a href = "{{ post.image.view_url() }}" rel = "nofollow ugc" data-fslightbox data-type = "image" target = "_blank" > < img src = "{{ post.image.medium_url() }}"
2024-03-16 00:09:11 +00:00
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" 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() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="lazy" />< / a >
{% 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" >
< 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 >
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-01-21 17:05:46 +13:00
< div class = "masonry_thumb" title = "{{ post.title }}" >
2024-01-21 16:09:46 +13:00
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('See image') }}" > < img src = "{{ post.url }}"
2024-01-21 16:12:04 +13:00
alt="{{ post.title }}" 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" >
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" title = "{{ post.title }}" > {{ post.title }}< / a > < / p >
< / 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" >
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" > {{ post.title }}< / a > < / p >
< / div >
2024-01-21 16:09:46 +13:00
{% endif %}
2024-01-21 15:44:13 +13:00
{% endif %}
< / div >
{% endif %}