debug issues found in production log

This commit is contained in:
rimu 2024-02-23 20:23:59 +13:00
parent e775a304a4
commit 93c52b2a86
5 changed files with 6 additions and 6 deletions

View file

@ -1013,7 +1013,7 @@ def comment_ap(comment_id):
resp.content_type = 'application/activity+json'
return resp
else:
reply = PostReply.query.get(comment_id)
reply = PostReply.query.get_or_404(comment_id)
return continue_discussion(reply.post.id, comment_id)

View file

@ -168,7 +168,7 @@ def post_to_activity(post: Post, community: Community):
if post.type == POST_TYPE_LINK and post.url is not None:
activity_data["object"]["object"]["attachment"] = {"href": post.url, "type": "Link"}
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:
activity_data["object"]["object"]["image"]['altText'] = post.image.alt_text
return activity_data

View file

@ -27,7 +27,7 @@ def show_domain(domain_id):
if current_user.is_anonymous or current_user.ignore_bots:
posts = Post.query.join(Community, Community.id == Post.community_id).\
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:
posts = Post.query.join(Community).filter(Post.domain_id == domain.id, Community.banned == False).order_by(desc(Post.posted_at))

View file

@ -197,10 +197,10 @@ def list_subscribed_communities():
verification_warning()
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:
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:
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_MODERATOR=SUBSCRIPTION_MODERATOR,
low_bandwidth=request.cookies.get('low_bandwidth', '0') == '1', moderating_communities=moderating_communities(current_user.get_id()),

View file

@ -756,7 +756,7 @@ def post_report(post_id: int):
url=f"https://{current_app.config['SERVER_NAME']}/post/{post.id}",
author_id=current_user.id)
db.session.add(notification)
already_notified.add(mod.id)
already_notified.add(mod.user_id)
post.reports += 1
# todo: only notify admins for certain types of report
for admin in Site.admins():