mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
debug issues found in production log
This commit is contained in:
parent
e775a304a4
commit
93c52b2a86
5 changed files with 6 additions and 6 deletions
|
@ -1013,7 +1013,7 @@ def comment_ap(comment_id):
|
||||||
resp.content_type = 'application/activity+json'
|
resp.content_type = 'application/activity+json'
|
||||||
return resp
|
return resp
|
||||||
else:
|
else:
|
||||||
reply = PostReply.query.get(comment_id)
|
reply = PostReply.query.get_or_404(comment_id)
|
||||||
return continue_discussion(reply.post.id, comment_id)
|
return continue_discussion(reply.post.id, comment_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ def post_to_activity(post: Post, community: Community):
|
||||||
if post.type == POST_TYPE_LINK and post.url is not None:
|
if post.type == POST_TYPE_LINK and post.url is not None:
|
||||||
activity_data["object"]["object"]["attachment"] = {"href": post.url, "type": "Link"}
|
activity_data["object"]["object"]["attachment"] = {"href": post.url, "type": "Link"}
|
||||||
if post.image_id is not None:
|
if post.image_id is not None:
|
||||||
activity_data["object"]["object"]["image"] = {"href": post.image.view_url(), "type": "Image"}
|
activity_data["object"]["object"]["image"] = {"url": post.image.view_url(), "type": "Image"}
|
||||||
if post.image.alt_text:
|
if post.image.alt_text:
|
||||||
activity_data["object"]["object"]["image"]['altText'] = post.image.alt_text
|
activity_data["object"]["object"]["image"]['altText'] = post.image.alt_text
|
||||||
return activity_data
|
return activity_data
|
||||||
|
|
|
@ -27,7 +27,7 @@ def show_domain(domain_id):
|
||||||
if current_user.is_anonymous or current_user.ignore_bots:
|
if current_user.is_anonymous or current_user.ignore_bots:
|
||||||
posts = Post.query.join(Community, Community.id == Post.community_id).\
|
posts = Post.query.join(Community, Community.id == Post.community_id).\
|
||||||
filter(Post.from_bot == False, Post.domain_id == domain.id, Community.banned == False).\
|
filter(Post.from_bot == False, Post.domain_id == domain.id, Community.banned == False).\
|
||||||
order_by(desc(Post.posted_at)).all()
|
order_by(desc(Post.posted_at))
|
||||||
else:
|
else:
|
||||||
posts = Post.query.join(Community).filter(Post.domain_id == domain.id, Community.banned == False).order_by(desc(Post.posted_at))
|
posts = Post.query.join(Community).filter(Post.domain_id == domain.id, Community.banned == False).order_by(desc(Post.posted_at))
|
||||||
|
|
||||||
|
|
|
@ -197,10 +197,10 @@ def list_subscribed_communities():
|
||||||
verification_warning()
|
verification_warning()
|
||||||
sort_by = text('community.' + request.args.get('sort_by') if request.args.get('sort_by') else 'community.post_reply_count desc')
|
sort_by = text('community.' + request.args.get('sort_by') if request.args.get('sort_by') else 'community.post_reply_count desc')
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
communities = Community.query.filter_by(banned=False).join(CommunityMember).filter(CommunityMember.user_id == current_user.id)
|
communities = Community.query.filter_by(banned=False).join(CommunityMember).filter(CommunityMember.user_id == current_user.id).order_by(sort_by).all()
|
||||||
else:
|
else:
|
||||||
communities = []
|
communities = []
|
||||||
return render_template('list_communities.html', communities=communities.order_by(sort_by).all(), title=_('Joined communities'),
|
return render_template('list_communities.html', communities=communities, title=_('Joined communities'),
|
||||||
SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, sort_by=sort_by,
|
SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, sort_by=sort_by,
|
||||||
SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
||||||
low_bandwidth=request.cookies.get('low_bandwidth', '0') == '1', moderating_communities=moderating_communities(current_user.get_id()),
|
low_bandwidth=request.cookies.get('low_bandwidth', '0') == '1', moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
|
|
|
@ -756,7 +756,7 @@ def post_report(post_id: int):
|
||||||
url=f"https://{current_app.config['SERVER_NAME']}/post/{post.id}",
|
url=f"https://{current_app.config['SERVER_NAME']}/post/{post.id}",
|
||||||
author_id=current_user.id)
|
author_id=current_user.id)
|
||||||
db.session.add(notification)
|
db.session.add(notification)
|
||||||
already_notified.add(mod.id)
|
already_notified.add(mod.user_id)
|
||||||
post.reports += 1
|
post.reports += 1
|
||||||
# todo: only notify admins for certain types of report
|
# todo: only notify admins for certain types of report
|
||||||
for admin in Site.admins():
|
for admin in Site.admins():
|
||||||
|
|
Loading…
Reference in a new issue