mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Show cross posts in UI
This commit is contained in:
parent
26be3a93b1
commit
f9cc69b054
3 changed files with 38 additions and 0 deletions
|
@ -1272,3 +1272,10 @@ def post_reply_notification(post_reply_id: int):
|
|||
post_reply.notify_author = not post_reply.notify_author
|
||||
db.session.commit()
|
||||
return render_template('post/_reply_notification_toggle.html', comment={'comment': post_reply})
|
||||
|
||||
|
||||
@bp.route('/post/<int:post_id>/cross_posts', methods=['GET'])
|
||||
def post_cross_posts(post_id: int):
|
||||
post = Post.query.get_or_404(post_id)
|
||||
cross_posts = Post.query.filter(Post.id.in_(post.cross_posts)).all()
|
||||
return render_template('post/post_cross_posts.html', post=post, cross_posts=cross_posts)
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
{% if post.nsfw %}<span class="warning_badge nsfw" title="{{ _('Not safe for work') }}">nsfw</span>{% endif %}
|
||||
{% if post.nsfl %}<span class="warning_badge nsfl" title="{{ _('Potentially emotionally scarring content') }}">nsfl</span>{% endif %}
|
||||
</h1>
|
||||
{% if post.cross_posts %}
|
||||
<a href="{{ url_for('post.post_cross_posts', post_id=post.id) }}" aria-label="{{ _('Show cross-posts') }}"><span class="fe fe-layers"></span></a>
|
||||
<span aria-label="{{ _('Number of cross-posts:') }}">{{ len(post.cross_posts) }}</span>
|
||||
{% endif %}
|
||||
{% if post.url %}
|
||||
<p><a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="Go to image">{{ post.url|shorten_url }}
|
||||
<span class="fe fe-external"></span></a></p>
|
||||
|
@ -66,6 +70,10 @@
|
|||
{% if post.nsfw %}<span class="warning_badge nsfw" title="{{ _('Not safe for work') }}">nsfw</span>{% endif %}
|
||||
{% if post.nsfl %}<span class="warning_badge nsfl" title="{{ _('Potentially emotionally scarring content') }}">nsfl</span>{% endif %}
|
||||
</h1>
|
||||
{% if post.cross_posts %}
|
||||
<a href="{{ url_for('post.post_cross_posts', post_id=post.id) }}" aria-label="{{ _('Show cross-posts') }}"><span class="fe fe-layers"></span></a>
|
||||
<span aria-label="{{ _('Number of cross-posts:') }}">{{ len(post.cross_posts) }}</span>
|
||||
{% endif %}
|
||||
{% if post.type == POST_TYPE_LINK and post.image_id and not (post.url and 'youtube.com' in post.url) %}
|
||||
<div class="url_thumbnail">
|
||||
<a href="{{ post.url }}" target="_blank" rel="nofollow ugc" class="post_link"><img src="{{ post.image.thumbnail_url() }}" alt="{{ post.image.alt_text if post.image.alt_text else '' }}"
|
||||
|
|
23
app/templates/post/post_cross_posts.html
Normal file
23
app/templates/post/post_cross_posts.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
||||
{% extends 'themes/' + theme() + '/base.html' %}
|
||||
{% else %}
|
||||
{% extends "base.html" %}
|
||||
{% endif %} %}
|
||||
{% from 'bootstrap/form.html' import render_form %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="row">
|
||||
<div class="col col-login mx-auto">
|
||||
<h3 class="mt-2 post_title">{{ _('Cross-posts for "%(post_title)s"', post_title=post.title) }}</h3>
|
||||
<ul class="cross_post_list">
|
||||
{% for cross_post in cross_posts %}
|
||||
<li><a href="{{ url_for('activitypub.post_ap', post_id=cross_post.id) }}">
|
||||
{{ cross_post.community.title }}@{{ cross_post.community.ap_domain }}</a>
|
||||
<span class="fe fe-reply"></span>
|
||||
<span>{{ cross_post.reply_count }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue