From 17d82011d333f175a655c1681dad1245debcabac Mon Sep 17 00:00:00 2001 From: Kai Wagner Date: Wed, 28 Jan 2026 08:17:39 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Added=20a=20per=E2=80=91user=20preference?= =?UTF-8?q?=20under=20Profile=20to=20toggle=20bold=20unread=20thread=20tit?= =?UTF-8?q?les=20and=20wired=20it=20into=20the=20topics=20list=20rendering?= =?UTF-8?q?/styles,=20plus=20a=20migration=20for=20the=20new=20user=20sett?= =?UTF-8?q?ing.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kai Wagner --- app/assets/stylesheets/components/topics.css | 8 ++++++++ .../settings/preferences_controller.rb | 2 +- app/views/settings/profiles/show.html.slim | 18 ++++++++++++++++++ app/views/topics/_topic_row_user.html.slim | 4 +++- app/views/topics/index.html.slim | 2 +- app/views/topics/search.html.slim | 2 +- ...8120000_add_bold_unread_threads_to_users.rb | 7 +++++++ db/schema.rb | 3 ++- 8 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20260128120000_add_bold_unread_threads_to_users.rb diff --git a/app/assets/stylesheets/components/topics.css b/app/assets/stylesheets/components/topics.css index 0d61a4b..d0daad3 100644 --- a/app/assets/stylesheets/components/topics.css +++ b/app/assets/stylesheets/components/topics.css @@ -283,6 +283,14 @@ a.topic-icon { color: var(--color-text-muted); } +.topics-table.unread-bold-enabled .topic-link { + font-weight: var(--font-weight-normal); +} + +.topics-table.unread-bold-enabled .topic-row.topic-unread .topic-link { + font-weight: var(--font-weight-bold); +} + .topic-icon-hover { display: none; position: absolute; diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 2050d7d..1c07e9c 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -13,7 +13,7 @@ def update private def preferences_params - params.require(:user).permit(:mention_restriction) + params.require(:user).permit(:mention_restriction, :bold_unread_threads) end end end diff --git a/app/views/settings/profiles/show.html.slim b/app/views/settings/profiles/show.html.slim index 6bdc939..0dd343a 100644 --- a/app/views/settings/profiles/show.html.slim +++ b/app/views/settings/profiles/show.html.slim @@ -28,3 +28,21 @@ strong Teammates only span.radio-description Only users who share a team with you can @mention you = f.submit "Save", class: "button-primary" + + .settings-section + h2 Thread Overview + p.settings-hint Choose how unread threads are emphasized in topic lists. + = form_with model: current_user, url: settings_preferences_path, method: :patch, local: true do |f| + .form-group + .radio-group + label + = f.radio_button :bold_unread_threads, false + span.radio-text + strong Colored marker only + span.radio-description Use the existing left-side status marker + label + = f.radio_button :bold_unread_threads, true + span.radio-text + strong Bold unread titles + span.radio-description Unread threads appear in bold like an email inbox + = f.submit "Save", class: "button-primary" diff --git a/app/views/topics/_topic_row_user.html.slim b/app/views/topics/_topic_row_user.html.slim index 30e3338..6f2576c 100644 --- a/app/views/topics/_topic_row_user.html.slim +++ b/app/views/topics/_topic_row_user.html.slim @@ -7,8 +7,10 @@ - tp_data = topic_participants_map[topic.id] || {} - top_participants = tp_data[:top] || [] - contributor_participants = tp_data[:contributors] || [] +- status = (state[:status] || "new").to_s +- unread_status = %w[new reading].include?(status) -tr id=dom_id(topic) class="topic-row topic-#{state[:status] || 'new'}" data-topic-id=topic.id data-last-message-id=topic.last_message_id +tr id=dom_id(topic) class=["topic-row", "topic-#{status}", ("topic-unread" if unread_status)].compact.join(" ") data-topic-id=topic.id data-last-message-id=topic.last_message_id = render partial: "topics/status_cell", locals: { topic: topic, state: state, note_count: note_count, team_readers: team_readers, star_data: star_data } td.topic-activity data-label="Activity" - replies_count = [topic.message_count - 1, 0].max diff --git a/app/views/topics/index.html.slim b/app/views/topics/index.html.slim index aa4ba39..7eb41e2 100644 --- a/app/views/topics/index.html.slim +++ b/app/views/topics/index.html.slim @@ -7,7 +7,7 @@ span Filtering by ##{@active_note_tag} = link_to "Clear", topics_path, class: "clear-tag-filter" - .topics-table + .topics-table class=("unread-bold-enabled" if current_user&.bold_unread_threads?) table thead tr diff --git a/app/views/topics/search.html.slim b/app/views/topics/search.html.slim index 277d85f..0f783b8 100644 --- a/app/views/topics/search.html.slim +++ b/app/views/topics/search.html.slim @@ -10,7 +10,7 @@ - if user_signed_in? #user-state-requests = turbo_frame_tag "user-state-root", src: user_state_frame_topics_path(topic_ids: @topics.map(&:id), format: :turbo_stream), loading: :eager - .topics-table + .topics-table class=("unread-bold-enabled" if current_user&.bold_unread_threads?) table thead tr diff --git a/db/migrate/20260128120000_add_bold_unread_threads_to_users.rb b/db/migrate/20260128120000_add_bold_unread_threads_to_users.rb new file mode 100644 index 0000000..c3e5c82 --- /dev/null +++ b/db/migrate/20260128120000_add_bold_unread_threads_to_users.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddBoldUnreadThreadsToUsers < ActiveRecord::Migration[8.0] + def change + add_column :users, :bold_unread_threads, :boolean, default: false, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 5c8cda2..b3deba9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2026_01_20_184149) do +ActiveRecord::Schema[8.0].define(version: 2026_01_28_120000) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" @@ -645,6 +645,7 @@ t.datetime "deleted_at" t.bigint "person_id", null: false t.enum "mention_restriction", default: "anyone", null: false, enum_type: "user_mention_restriction" + t.boolean "bold_unread_threads", default: false, null: false t.index ["deleted_at"], name: "index_users_on_deleted_at" t.index ["person_id"], name: "index_users_on_person_id" t.index ["username"], name: "index_users_on_username", unique: true From 3dce003e718f78f297b96686226ff52ed7c50dcf Mon Sep 17 00:00:00 2001 From: Kai Wagner Date: Wed, 28 Jan 2026 08:23:11 +0100 Subject: [PATCH 2/2] missed aware status Signed-off-by: Kai Wagner --- app/views/topics/_topic_row_user.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/topics/_topic_row_user.html.slim b/app/views/topics/_topic_row_user.html.slim index 6f2576c..ae9c0b8 100644 --- a/app/views/topics/_topic_row_user.html.slim +++ b/app/views/topics/_topic_row_user.html.slim @@ -8,7 +8,7 @@ - top_participants = tp_data[:top] || [] - contributor_participants = tp_data[:contributors] || [] - status = (state[:status] || "new").to_s -- unread_status = %w[new reading].include?(status) +- unread_status = %w[new reading aware].include?(status) tr id=dom_id(topic) class=["topic-row", "topic-#{status}", ("topic-unread" if unread_status)].compact.join(" ") data-topic-id=topic.id data-last-message-id=topic.last_message_id = render partial: "topics/status_cell", locals: { topic: topic, state: state, note_count: note_count, team_readers: team_readers, star_data: star_data }