From 6e7318612746ca5bca721c2e3df68cc807535c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 10 Jun 2026 17:59:51 +0300 Subject: [PATCH] add mark as read button(s) to inbox --- app/routes/threads.py | 20 ++++++++++++++++++++ app/templates/threads/thread.html | 4 ++-- app/templates/users/inbox.html | 23 +++++++++++++++++++++-- data/static/css/style.css | 4 ++++ 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/app/routes/threads.py b/app/routes/threads.py index c50dced..a92a0c7 100644 --- a/app/routes/threads.py +++ b/app/routes/threads.py @@ -166,6 +166,26 @@ def unsubscribe(thread_id): subscription.delete() return redirect(return_to) +@bp.post('/subscriptions/unsubscribe-all/') +@login_required +def unsubscribe_all(): + user = get_active_user() + +@bp.post('/subscriptions/mark-read/') +@login_required +def mark_read(): + # TODO: make a return_to param + user = get_active_user() + sub_ids = request.form.getlist('id[]', type=int) + now = time_now() + for sub_id in sub_ids: + sub = Subscriptions.find({'id': sub_id, 'user_id': user.id}) + if not sub: + continue + sub.update({'last_seen': now}) + + return redirect(url_for('users.inbox', username=user.username)) + @bp.get('//feed.atom/') def feed(thread_id): return 'stub' diff --git a/app/templates/threads/thread.html b/app/templates/threads/thread.html index 7349893..6057dff 100644 --- a/app/templates/threads/thread.html +++ b/app/templates/threads/thread.html @@ -1,4 +1,4 @@ -{%- from 'common/macros.html' import subheader, timestamp, pager, babycode_editor_component -%} +{%- from 'common/macros.html' import subheader, timestamp, pager, babycode_editor_component, bookmark_button -%} {%- from 'common/icons.html' import icn_bookmark -%} {%- from 'common/macros.html' import full_post, bookmark_menu with context -%} {%- extends 'base.html' -%} @@ -31,7 +31,7 @@ - + {{- bookmark_button('thread', thread.id) -}} {%- endif -%} Subscribe via RSS diff --git a/app/templates/users/inbox.html b/app/templates/users/inbox.html index 26f1887..cc56fe0 100644 --- a/app/templates/users/inbox.html +++ b/app/templates/users/inbox.html @@ -12,7 +12,20 @@ You do not have any subscriptions. {%- endif -%} {%- endset -%} -{{ subheader('Your inbox', topline) }} +{%- call() subheader('Your inbox', topline) -%} +
+ Actions +
+ {%- for sub in subscriptions -%} + + {%- endfor -%} + +
+
+ +
+
+{%- endcall -%} {%- if subscriptions | length > 0 -%}
{%- for sub in subscriptions -%} @@ -20,11 +33,17 @@ {%- set thread = sub.get_thread() -%} {{thread.title}} ({{sub.get_unread_count()}} unread) -
+
+ Go to thread +
+ + +
+
{%- set posts = sub.get_full_posts_view() -%} diff --git a/data/static/css/style.css b/data/static/css/style.css index 61d905a..f991902 100644 --- a/data/static/css/style.css +++ b/data/static/css/style.css @@ -335,6 +335,10 @@ form.horizontal { flex-wrap: wrap; } + &.inline { + display: inline flex; + } + &> fieldset { display: flex; gap: var(--base-padding);