A platform for community discussion. Free, open, simple.
UX: Replace `short_progress_text_threshold` with automatic fitting
Régis Hanol0b38dbfd7312
diff --git a/app/assets/stylesheets/common/topic-timeline.scss b/app/assets/stylesheets/common/topic-timeline.scssindex 7a8066e7547..673aef646c9 100644--- a/app/assets/stylesheets/common/topic-timeline.scss+++ b/app/assets/stylesheets/common/topic-timeline.scss@@ -302,9 +302,12 @@}.timeline-replies {+ display: flex;+ flex-wrap: wrap;+ height: 1lh;overflow: hidden;- overflow-wrap: break-word;font-weight: bold;+ white-space: pre;}.timeline-last-read {diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex c01655127d0..fe0c987b785 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -2975,7 +2975,6 @@ en:enable_names: "Show the user's full name on their profile, user card, and emails. Disable to hide full name everywhere."display_name_on_posts: "Show a user's full name on their posts in addition to their @username."show_time_gap_days: "If two posts are made this many days apart, display the time gap in the topic."- short_progress_text_threshold: "After the number of posts in a topic goes above this number, the progress bar will only show the current post number. If you change the progress bar's width, you may need to change this value."default_code_lang: "Default programming language syntax highlighting applied to markdown code blocks (auto, text, ruby, python etc.). This value must also be present in the {{setting:highlighted_languages}} site setting."autohighlight_all_code: "Apply syntax highlighting to HTML-authored <code> blocks, even if they didn't specify a language. To configure markdown-authored code blocks, use the {{setting:default_code_lang}} setting."highlighted_languages: "Included syntax highlighting rules. (Warning: including too many languages may impact performance) see: <a href='https://highlightjs.org/demo/' target='_blank'>https://highlightjs.org/demo</a> for a demo"diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 17a1cb04405..bd1ec243faf 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -1673,11 +1673,6 @@ posting:max: 36500client: truearea: "posts_and_topics"- short_progress_text_threshold:- client: true- default: 10000- max: 99000- area: "posts_and_topics"default_code_lang:client: truedefault: "auto"diff --git a/db/post_migrate/20261030180958_remove_short_progress_text_threshold_setting.rb b/db/post_migrate/20261030180958_remove_short_progress_text_threshold_setting.rbnew file mode 100644index 00000000000..c45626e3b58--- /dev/null+++ b/db/post_migrate/20261030180958_remove_short_progress_text_threshold_setting.rb@@ -0,0 +1,11 @@+# frozen_string_literal: true+class RemoveShortProgressTextThresholdSetting < ActiveRecord::Migration[8.1]+ def up+ execute "DELETE FROM site_settings WHERE name = 'short_progress_text_threshold'"+ execute "DELETE FROM site_setting_groups WHERE name = 'short_progress_text_threshold'"+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/db/structure.sql b/db/structure.sqlindex 6590c9f7b91..e01ed4944ce 100644--- a/db/structure.sql+++ b/db/structure.sql@@ -26508,6 +26508,7 @@ ALTER TABLE ONLY public.ad_plugin_house_ads_groupsSET search_path TO "$user", public;INSERT INTO "schema_migrations" (version) VALUES+('20261030180958'),('20261029021723'),('20261028093149'),('20261028093146'),diff --git a/frontend/discourse/app/components/topic-progress.gjs b/frontend/discourse/app/components/topic-progress.gjsindex cf2423c527b..d6f44d383bd 100644--- a/frontend/discourse/app/components/topic-progress.gjs+++ b/frontend/discourse/app/components/topic-progress.gjs@@ -41,14 +41,6 @@ export default class TopicProgress extends Component {);}- @computed("postStream.filteredPostsCount")- get hugeNumberOfPosts() {- return (- this.postStream?.filteredPostsCount >=- this.siteSettings.short_progress_text_threshold- );- }-@computed("progressPosition","topic.last_read_post_id",@@ -145,10 +137,8 @@ export default class TopicProgress extends Component {><div class="nums"><span>{{this.progressPosition}}</span>- <span class={{if this.hugeNumberOfPosts "hidden"}}>/</span>- <span- class={{if this.hugeNumberOfPosts "hidden"}}- >{{this.postStream.filteredPostsCount}}</span>+ <span>/</span>+ <span>{{this.postStream.filteredPostsCount}}</span></div><div class="bg"></div></nav>diff --git a/frontend/discourse/app/components/topic-timeline/scroller.gjs b/frontend/discourse/app/components/topic-timeline/scroller.gjsindex 9247f34e14b..6d8d80d3a69 100644--- a/frontend/discourse/app/components/topic-timeline/scroller.gjs+++ b/frontend/discourse/app/components/topic-timeline/scroller.gjs@@ -10,9 +10,9 @@ import { i18n } from "discourse-i18n";export default class TopicTimelineScroller extends Component {style = trustHTML(`height: ${SCROLLER_HEIGHT}px`);- get repliesShort() {- return i18n(`topic.timeline.replies_short`, {- current: this.args.current,+ get totalLabel() {+ return i18n("topic.timeline.replies_short", {+ current: "",total: this.args.total,});}@@ -41,7 +41,8 @@ export default class TopicTimelineScroller extends Component {{{/unless}}<div class="timeline-scroller-content"><div class="timeline-replies">- {{this.repliesShort}}+ <span>{{@current}}</span>+ <span>{{this.totalLabel}}</span></div>{{#if @date}}<div class="timeline-ago">diff --git a/frontend/discourse/tests/integration/components/topic-timeline-test.gjs b/frontend/discourse/tests/integration/components/topic-timeline-test.gjsindex 35c1d95db56..4c0d3f893c1 100644--- a/frontend/discourse/tests/integration/components/topic-timeline-test.gjs+++ b/frontend/discourse/tests/integration/components/topic-timeline-test.gjs@@ -63,4 +63,35 @@ module("Integration | Component | topic-timeline", function (hooks) {assert.true(jumpToIndex.calledOnceWith(55));});++ test("shows the total posts count only when it fits", async function (assert) {+ const topic = createMegaTopic(this, { highest_post_number: 10_050 });+ const jumpTop = () => {};+ const sameLine = () => {+ const [current, total] = document.querySelectorAll(+ ".timeline-replies span"+ );+ return current.offsetTop === total.offsetTop;+ };++ await render(+ <template>+ <TopicTimeline @enteredIndex={{5000}} @model={{topic}} />+ </template>+ );+ assert.dom(".timeline-replies").hasText("5001 / 10050");+ assert.true(sameLine(), "the total fits next to the current post");++ await render(+ <template>+ <TopicTimeline+ @enteredIndex={{5000}}+ @fullscreen={{true}}+ @jumpTop={{jumpTop}}+ @model={{topic}}+ />+ </template>+ );+ assert.false(sameLine(), "the total wraps out of view");+ });});diff --git a/spec/system/page_objects/components/topic_timeline.rb b/spec/system/page_objects/components/topic_timeline.rbindex 3773b905840..199e268763f 100644--- a/spec/system/page_objects/components/topic_timeline.rb+++ b/spec/system/page_objects/components/topic_timeline.rb@@ -14,7 +14,11 @@ module PageObjects# stream having loaded a post: a cloaked post keeps its `#post_N` id, so# `has_post_number?` is satisfied by a placeholder the reader never reached.def has_position?(current, total)- has_css?("#{SCROLLER_SELECTOR} .timeline-replies", exact_text: "#{current} / #{total}")+ has_css?(+ "#{SCROLLER_SELECTOR} .timeline-replies",+ exact_text: "#{current} / #{total}",+ normalize_ws: true,+ )enddef drag_to_bottom