mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
post soft-deletion: show deleted posts in user profile to provide restoration route
This commit is contained in:
parent
0c0b0e4212
commit
9a033522d1
6 changed files with 8 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
||||||
|
{% if post.deleted -%}<span class="red fe fe-delete" title="{{ _('Post deleted') }}"></span>{% endif -%}
|
||||||
</h3>
|
</h3>
|
||||||
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
||||||
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
||||||
|
{% if post.deleted -%}<span class="red fe fe-delete" title="{{ _('Post deleted') }}"></span>{% endif -%}
|
||||||
</h3>
|
</h3>
|
||||||
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
||||||
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
||||||
|
{% if post.deleted -%}<span class="red fe fe-delete" title="{{ _('Post deleted') }}"></span>{% endif -%}
|
||||||
</h3>
|
</h3>
|
||||||
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
||||||
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
||||||
|
{% if post.deleted -%}<span class="red fe fe-delete" title="{{ _('Post deleted') }}"></span>{% endif -%}
|
||||||
</h3>
|
</h3>
|
||||||
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
||||||
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
{% if post.sticky -%}<span class="fe fe-sticky-right"></span>{% endif -%}
|
||||||
|
{% if post.deleted -%}<span class="red fe fe-delete" title="{{ _('Post deleted') }}"></span>{% endif -%}
|
||||||
</h3>
|
</h3>
|
||||||
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">
|
||||||
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
{% if post.community.icon_id and not low_bandwidth %}<img class="community_icon_small rounded-circle" src="{{ post.community.icon_image('tiny') }}" alt="Community icon" />{% endif -%}
|
||||||
|
|
|
@ -55,7 +55,6 @@ def show_profile(user):
|
||||||
post_page = request.args.get('post_page', 1, type=int)
|
post_page = request.args.get('post_page', 1, type=int)
|
||||||
replies_page = request.args.get('replies_page', 1, type=int)
|
replies_page = request.args.get('replies_page', 1, type=int)
|
||||||
|
|
||||||
posts = Post.query.filter_by(user_id=user.id).filter(Post.deleted == False).order_by(desc(Post.posted_at)).paginate(page=post_page, per_page=50, error_out=False)
|
|
||||||
moderates = Community.query.filter_by(banned=False).join(CommunityMember).filter(CommunityMember.user_id == user.id)\
|
moderates = Community.query.filter_by(banned=False).join(CommunityMember).filter(CommunityMember.user_id == user.id)\
|
||||||
.filter(or_(CommunityMember.is_moderator, CommunityMember.is_owner))
|
.filter(or_(CommunityMember.is_moderator, CommunityMember.is_owner))
|
||||||
if current_user.is_authenticated and (user.id == current_user.get_id() or current_user.is_admin()):
|
if current_user.is_authenticated and (user.id == current_user.get_id() or current_user.is_admin()):
|
||||||
|
@ -65,10 +64,13 @@ def show_profile(user):
|
||||||
subscribed = Community.query.filter_by(banned=False).join(CommunityMember).filter(CommunityMember.user_id == user.id).all()
|
subscribed = Community.query.filter_by(banned=False).join(CommunityMember).filter(CommunityMember.user_id == user.id).all()
|
||||||
if current_user.is_anonymous or (user.id != current_user.id and not current_user.is_admin()):
|
if current_user.is_anonymous or (user.id != current_user.id and not current_user.is_admin()):
|
||||||
moderates = moderates.filter(Community.private_mods == False)
|
moderates = moderates.filter(Community.private_mods == False)
|
||||||
|
posts = Post.query.filter_by(user_id=user.id).filter(Post.deleted == False).order_by(desc(Post.posted_at)).paginate(page=post_page, per_page=50, error_out=False)
|
||||||
post_replies = PostReply.query.filter_by(user_id=user.id, deleted=False).order_by(desc(PostReply.posted_at)).paginate(page=replies_page, per_page=50, error_out=False)
|
post_replies = PostReply.query.filter_by(user_id=user.id, deleted=False).order_by(desc(PostReply.posted_at)).paginate(page=replies_page, per_page=50, error_out=False)
|
||||||
elif current_user.is_admin():
|
elif current_user.is_admin():
|
||||||
|
posts = Post.query.filter_by(user_id=user.id).order_by(desc(Post.posted_at)).paginate(page=post_page, per_page=50, error_out=False)
|
||||||
post_replies = PostReply.query.filter_by(user_id=user.id).order_by(desc(PostReply.posted_at)).paginate(page=replies_page, per_page=50, error_out=False)
|
post_replies = PostReply.query.filter_by(user_id=user.id).order_by(desc(PostReply.posted_at)).paginate(page=replies_page, per_page=50, error_out=False)
|
||||||
elif current_user.id == user.id:
|
elif current_user.id == user.id:
|
||||||
|
posts = Post.query.filter_by(user_id=user.id).filter(or_(Post.deleted == False, Post.deleted_by == user.id)).order_by(desc(Post.posted_at)).paginate(page=post_page, per_page=50, error_out=False)
|
||||||
post_replies = PostReply.query.filter_by(user_id=user.id).filter(or_(PostReply.deleted == False, PostReply.deleted_by == user.id)).order_by(desc(PostReply.posted_at)).paginate(page=replies_page, per_page=50, error_out=False)
|
post_replies = PostReply.query.filter_by(user_id=user.id).filter(or_(PostReply.deleted == False, PostReply.deleted_by == user.id)).order_by(desc(PostReply.posted_at)).paginate(page=replies_page, per_page=50, error_out=False)
|
||||||
|
|
||||||
# profile info
|
# profile info
|
||||||
|
|
Loading…
Add table
Reference in a new issue