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-21 16:01:32 +13:00
{% if post.image.thumbnail_url() %}
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('Read article') }}" > < img src = "{{ post.image.thumbnail_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="lazy" />< / a >
{% elif post.image.source_url %}
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('Read article') }}" > < img src = "{{ post.image.source_url }}"
alt="{{ post.title }}" loading="lazy" />< / a >
{% else %}
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('Read article') }}" > < 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 %}
< a href = "{{ post.image.view_url() }}" rel = "nofollow ugc" target = "_blank" > < img src = "{{ post.image.thumbnail_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="lazy" />< / a >
{% 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-21 17:05:46 +13:00
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" title = "{{ post.title }}" > {{ post.title|shorten(25) }}< / a > < / p >
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-21 17:05:46 +13:00
< p > < a href = "{{ url_for('activitypub.post_ap', post_id=post.id) }}" title = "{{ post.title }}" > {{ post.title|shorten(25) }}< / a > < / p >
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 >
<!--
< div class = "row" >
< div class = "col-12" >
< div class = "row main_row" >
< div class = "col" >
< h3 class = "post_teaser_title" >
< div class = "voting_buttons" >
{% include "post/_post_voting_buttons.html" %}
< / div >
{% if post.image_id and not low_bandwidth %}
< div class = "thumbnail" >
{% if post.type == POST_TYPE_LINK %}
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" aria-label = "{{ _('Read article') }}" > < img src = "{{ post.image.thumbnail_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" height="50" />< / a >
{% elif post.type == POST_TYPE_IMAGE %}
{% if post.image_id %}
< a href = "{{ post.image.view_url() }}" rel = "nofollow ugc" target = "_blank" > < img src = "{{ post.image.thumbnail_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" height="50" />< / a >
{% endif %}
{% 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 '' }}" height="50" />< / a >
{% endif %}
< / div >
{% endif %}
< a href = "{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None) }}" class = "post_teaser_title_a" > {{ post.title }}< / a >
{% if post.type == POST_TYPE_IMAGE %}< span class = "fe fe-image" > < / span > {% endif %}
{% if post.type == POST_TYPE_LINK and post.domain_id %}
{% if post.url and 'youtube.com' in post.url %}
< span class = "fe fe-video" > < / span >
{% endif %}
< a href = "{{ post.url }}" rel = "nofollow ugc" target = "_blank" class = "post_link" >
< img src = "/static/images/external_link_black.svg" class = "external_link_icon" alt = "External link" / >
< / a >
< span class = "domain_link" > (< a href = "/d/{{ post.domain_id }}" > {{ post.domain.name }}< / a > )< / span >
{% endif %}
{% if post.reports and current_user.is_authenticated and post.community.is_moderator(current_user) %}
< span class = "red fe fe-report" title = "{{ _('Reported. Check post for issues.') }}" > < / span >
{% endif %}
< / h3 >
< span class = "small" > {% if show_post_community %}< strong > < a href = "/c/{{ post.community.link() }}" > c/{{ post.community.name }}< / a > < / strong > {% endif %}
by {{ render_username(post.author) }} {{ moment(post.last_active if sort == 'active' else post.posted_at).fromNow() }}< / span >
< / div >
< / div >
< div class = "row utilities_row" >
< div class = "col-6" >
< 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') }}" > < span class = "fe fe-reply" > < / span > < / a >
< a href = "{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None, _anchor='post_replies') }}" > {{ post.reply_count }}< / a >
{% if post.type == POST_TYPE_IMAGE %}
{% if post.image_id %}
< a href = "{{ post.image.view_url() }}" rel = "nofollow ugc" class = "preview_image" aria-label = "{{ _('View image') }}" > < span class = "fe fe-magnify" > < / span > < / a >
{% else %}
< a href = "{{ post.url }}" rel = "nofollow ugc" class = "preview_image" target = "_blank" aria-label = "{{ _('View image') }}" > < span class = "fe fe-magnify" > < / span > < / a >
{% endif %}
{% endif %}
< / div >
< div class = "col-2" > < a href = "{{ url_for('post.post_options', post_id=post.id) }}" rel = "nofollow" aria-label = "{{ _('Options') }}" > < span class = "fe fe-options" title = "Options" > < / span > < / a > < / div >
< / div >
< / div >
< / div >
< / div >
-->
{% endif %}