add inbox view

This commit is contained in:
2026-05-20 21:12:05 +03:00
parent 5db63d6907
commit 72172dbb1c
5 changed files with 84 additions and 18 deletions

View File

@@ -148,15 +148,19 @@ def unsubscribe(thread_id):
user = get_active_user()
last_post_id = request.form.get('last_post_id', None)
if last_post_id is None:
return_to = request.form.get('return_to', None)
if return_to is None and last_post_id is None:
abort(400)
elif return_to is None and last_post_id is not None:
return_to = url_for('.thread_by_id', thread_id=thread_id, after=last_post_id)
subscription = Subscriptions.find({'user_id': user.id, 'thread_id': thread_id})
if not subscription:
return redirect(url_for('.thread_by_id', thread_id=thread_id, after=last_post_id))
return redirect(return_to)
subscription.delete()
return redirect(url_for('.thread_by_id', thread_id=thread_id, after=last_post_id))
return redirect(return_to)
@bp.get('/<int:thread_id>/feed.atom/')
def feed(thread_id):

View File

@@ -189,8 +189,10 @@ def settings(username):
@login_required
@redirect_to_own
def inbox(username):
username = username.lower()
return 'stub'
user = get_active_user()
unread_count = user.get_unread_count()
subscriptions = user.get_all_subscriptions()
return render_template('users/inbox.html', unread_count=unread_count, subscriptions=subscriptions)
@bp.get('/<username>/bookmarks/')
@login_required