A platform for community discussion. Free, open, simple.
DEV: Set glimmer-topic-list to 'auto' by default (#30582)
David Taylor6330e6ceaed5
diff --git a/app/assets/javascripts/discourse-common/addon/deprecation-workflow.js b/app/assets/javascripts/discourse-common/addon/deprecation-workflow.jsindex 3e42216a42b..f80c3690057 100644--- a/app/assets/javascripts/discourse-common/addon/deprecation-workflow.js+++ b/app/assets/javascripts/discourse-common/addon/deprecation-workflow.js@@ -6,10 +6,6 @@ const DEPRECATION_WORKFLOW = [handler: "silence",matchId: "discourse.decorate-widget.hamburger-widget-links",},- {- handler: "silence",- matchId: "discourse.hbr-topic-list-overrides",- },];export default DEPRECATION_WORKFLOW;diff --git a/app/assets/javascripts/discourse-common/addon/lib/raw-templates.js b/app/assets/javascripts/discourse-common/addon/lib/raw-templates.jsindex b1d3fb78efc..95dff0d60a0 100644--- a/app/assets/javascripts/discourse-common/addon/lib/raw-templates.js+++ b/app/assets/javascripts/discourse-common/addon/lib/raw-templates.js@@ -1,5 +1,5 @@import require from "require";-import { consolePrefix } from "discourse/lib/source-identifier";+import { RAW_TOPIC_LIST_DEPRECATION_OPTIONS } from "discourse/lib/plugin-api";import deprecated from "discourse-common/lib/deprecated";import { getResolverOption } from "discourse-common/resolver";@@ -50,28 +50,9 @@ export function addRawTemplate(name, template, opts = {}) {const message = `[${name}] hbr topic-list template overrides and connectors are deprecated. Use the value transformer \`topic-list-columns\` and other new topic-list plugin APIs instead.`;// NOTE: addRawTemplate is called too early for deprecation handlers to process this:- deprecated(message, {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- });+ deprecated(message, RAW_TOPIC_LIST_DEPRECATION_OPTIONS);needsHbrTopicList(true);-- let prefix;- if (opts.themeId) {- prefix = consolePrefix(null, {- type: "theme",- id: opts.themeId,- name: opts.themeName,- });- } else if (opts.pluginName) {- prefix = consolePrefix(null, {- type: "plugin",- name: opts.pluginName,- });- }- // eslint-disable-next-line no-console- console.debug(prefix, message);}// Core templates should never overwrite themes / pluginsdiff --git a/app/assets/javascripts/discourse/app/components/topic-list-item.js b/app/assets/javascripts/discourse/app/components/topic-list-item.jsindex b4d8b83e4fb..c1fa97b9f34 100644--- a/app/assets/javascripts/discourse/app/components/topic-list-item.js+++ b/app/assets/javascripts/discourse/app/components/topic-list-item.js@@ -12,6 +12,7 @@ import {import { observes, on } from "@ember-decorators/object";import $ from "jquery";import { wantsNewWindow } from "discourse/lib/intercept-click";+import { RAW_TOPIC_LIST_DEPRECATION_OPTIONS } from "discourse/lib/plugin-api";import { applyValueTransformer } from "discourse/lib/transformer";import DiscourseURL, { groupPath } from "discourse/lib/url";import deprecated from "discourse-common/lib/deprecated";@@ -54,10 +55,7 @@ export default class TopicListItem extends Component {static reopen() {deprecated("Modifying topic-list-item with `reopen` is deprecated. Use the value transformer `topic-list-columns` and other new topic-list plugin APIs instead.",- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);return super.reopen(...arguments);@@ -66,10 +64,7 @@ export default class TopicListItem extends Component {static reopenClass() {deprecated("Modifying topic-list-item with `reopenClass` is deprecated. Use the value transformer `topic-list-columns` and other new topic-list plugin APIs instead.",- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);return super.reopenClass(...arguments);diff --git a/app/assets/javascripts/discourse/app/components/topic-list.js b/app/assets/javascripts/discourse/app/components/topic-list.jsindex c425dc1a666..2a3b43365fd 100644--- a/app/assets/javascripts/discourse/app/components/topic-list.js+++ b/app/assets/javascripts/discourse/app/components/topic-list.js@@ -8,6 +8,7 @@ import {tagName,} from "@ember-decorators/component";import { observes, on } from "@ember-decorators/object";+import { RAW_TOPIC_LIST_DEPRECATION_OPTIONS } from "discourse/lib/plugin-api";import LoadMore from "discourse/mixins/load-more";import deprecated from "discourse-common/lib/deprecated";import discourseComputed from "discourse-common/utils/decorators";@@ -19,10 +20,7 @@ export default class TopicList extends Component.extend(LoadMore) {static reopen() {deprecated("Modifying topic-list with `reopen` is deprecated. Use the value transformer `topic-list-columns` and other new topic-list plugin APIs instead.",- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);return super.reopen(...arguments);@@ -31,10 +29,7 @@ export default class TopicList extends Component.extend(LoadMore) {static reopenClass() {deprecated("Modifying topic-list with `reopenClass` is deprecated. Use the value transformer `topic-list-columns` and other new topic-list plugin APIs instead.",- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);return super.reopenClass(...arguments);diff --git a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs b/app/assets/javascripts/discourse/app/components/topic-list/item.gjsindex 3358544671c..1ae0143e14a 100644--- a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs+++ b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs@@ -35,7 +35,8 @@ export default class Item extends Component {next(() => this.historyStore.delete("lastTopicIdViewed"));if (this.shouldFocusLastVisited) {- element.querySelector(".main-link .title")?.focus();+ // Using next() so it always runs after clean-dom+ next(() => element.querySelector(".main-link .title")?.focus());}} else if (this.args.topic.get("highlight")) {// highlight new topics that have been loaded from the server or the one we just created@@ -133,7 +134,8 @@ export default class Item extends Component {click(e) {if (e.target.classList.contains("raw-topic-link") ||- e.target.classList.contains("post-activity")+ e.target.classList.contains("post-activity") ||+ e.target.classList.contains("badge-posts")) {if (wantsNewWindow(e)) {return;@@ -163,7 +165,11 @@ export default class Item extends Component {@actionkeyDown(e) {- if (e.key === "Enter" && e.target.classList.contains("post-activity")) {+ if (+ e.key === "Enter" &&+ (e.target.classList.contains("post-activity") ||+ e.target.classList.contains("badge-posts"))+ ) {e.preventDefault();this.navigateToTopic(this.args.topic, e.target.href);}diff --git a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs b/app/assets/javascripts/discourse/app/components/topic-list/list.gjsindex 316985ae9d7..5429dd24012 100644--- a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs+++ b/app/assets/javascripts/discourse/app/components/topic-list/list.gjs@@ -110,7 +110,9 @@ export default class TopicList extends Component {}get bulkSelectEnabled() {- return this.args.bulkSelectHelper?.bulkSelectEnabled;+ return (+ this.args.bulkSelectHelper?.bulkSelectEnabled && this.args.canBulkSelect+ );}get canDoBulkActions() {diff --git a/app/assets/javascripts/discourse/app/instance-initializers/hbr-topic-list-overrides.js b/app/assets/javascripts/discourse/app/instance-initializers/hbr-topic-list-overrides.jsindex c5aa68f3a34..253b69ae263 100644--- a/app/assets/javascripts/discourse/app/instance-initializers/hbr-topic-list-overrides.js+++ b/app/assets/javascripts/discourse/app/instance-initializers/hbr-topic-list-overrides.js@@ -1,4 +1,3 @@-import { consolePrefix } from "discourse/lib/source-identifier";import { registerDeprecationHandler } from "discourse-common/lib/deprecated";import { needsHbrTopicList } from "discourse-common/lib/raw-templates";@@ -9,8 +8,6 @@ export default {registerDeprecationHandler((message, opts) => {if (opts?.id === "discourse.hbr-topic-list-overrides") {needsHbrTopicList(true);- // eslint-disable-next-line no-console- console.debug(consolePrefix(), message);}});},diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.gjs b/app/assets/javascripts/discourse/app/lib/plugin-api.gjsindex fffc95ee0f5..d14e55cf561 100644--- a/app/assets/javascripts/discourse/app/lib/plugin-api.gjs+++ b/app/assets/javascripts/discourse/app/lib/plugin-api.gjs@@ -176,6 +176,12 @@ const POST_MENU_DEPRECATION_OPTIONS = {url: "https://meta.discourse.org/t/341014",};+export const RAW_TOPIC_LIST_DEPRECATION_OPTIONS = {+ since: "v3.4.0.beta4-dev",+ id: "discourse.hbr-topic-list-overrides",+ url: "https://meta.discourse.org/t/343404",+};+const appliedModificationIds = new WeakMap();// This helper prevents us from applying the same `modifyClass` over and over in test mode.@@ -306,10 +312,7 @@ class PluginApi {) {deprecated(`Modifying '${resolverName}' with 'modifyClass' is deprecated. Use the value transformer 'topic-list-columns' and other new topic-list plugin APIs instead.`,- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);}@@ -357,10 +360,7 @@ class PluginApi {) {deprecated(`Modifying '${resolverName}' with 'modifyClass' is deprecated. Use the value transformer 'topic-list-columns' and other new topic-list plugin APIs instead.`,- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);}diff --git a/app/assets/javascripts/discourse/app/raw-views/topic-status.js b/app/assets/javascripts/discourse/app/raw-views/topic-status.jsindex c5feb15d8d7..6406dda5fc0 100644--- a/app/assets/javascripts/discourse/app/raw-views/topic-status.js+++ b/app/assets/javascripts/discourse/app/raw-views/topic-status.js@@ -1,4 +1,5 @@import EmberObject from "@ember/object";+import { RAW_TOPIC_LIST_DEPRECATION_OPTIONS } from "discourse/lib/plugin-api";import deprecated from "discourse-common/lib/deprecated";import discourseComputed from "discourse-common/utils/decorators";import { i18n } from "discourse-i18n";@@ -7,10 +8,7 @@ export default class TopicStatus extends EmberObject {static reopen() {deprecated("Modifying raw-view:topic-status with `reopen` is deprecated. Use the value transformer `topic-list-columns` and other new topic-list plugin APIs instead.",- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);return super.reopen(...arguments);@@ -19,10 +17,7 @@ export default class TopicStatus extends EmberObject {static reopenClass() {deprecated("Modifying raw-view:topic-status with `reopenClass` is deprecated. Use the value transformer `topic-list-columns` and other new topic-list plugin APIs instead.",- {- since: "v3.4.0.beta3-dev",- id: "discourse.hbr-topic-list-overrides",- }+ RAW_TOPIC_LIST_DEPRECATION_OPTIONS);return super.reopenClass(...arguments);diff --git a/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js b/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.jsindex e04a3622d2e..b8d0877c38c 100644--- a/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js@@ -2,6 +2,7 @@ import { visit } from "@ember/test-helpers";import { compile } from "handlebars";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";+import { withSilencedDeprecations } from "discourse-common/lib/deprecated";import {addRawTemplate,removeRawTemplate,@@ -12,10 +13,12 @@ const CONNECTOR =acceptance("Raw Plugin Outlet", function (needs) {needs.hooks.beforeEach(function () {- addRawTemplate(- CONNECTOR,- compile(`<span class='topic-lala'>{{context.topic.id}}</span>`)- );+ withSilencedDeprecations("discourse.hbr-topic-list-overrides", () => {+ addRawTemplate(+ CONNECTOR,+ compile(`<span class='topic-lala'>{{context.topic.id}}</span>`)+ );+ });});needs.hooks.afterEach(function () {diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-entrance-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-entrance-test.jsdeleted file mode 100644index 5d7e1447b0b..00000000000--- a/app/assets/javascripts/discourse/tests/acceptance/topic-entrance-test.js+++ /dev/null@@ -1,22 +0,0 @@-import { click, triggerKeyEvent, visit } from "@ember/test-helpers";-import { test } from "qunit";-import { acceptance } from "discourse/tests/helpers/qunit-helpers";--acceptance("Topic Entrance Modal", function () {- test("can be closed with the esc key", async function (assert) {- await visit("/");- await click(".topic-list-item button.posts-map");-- assert- .dom("#topic-entrance")- .doesNotHaveClass("hidden", "topic entrance modal appears");- assert- .dom("#topic-entrance .jump-top")- .isFocused("the jump top button has focus when the modal is shown");-- await triggerKeyEvent("#topic-entrance", "keydown", "Escape");- assert- .dom("#topic-entrance")- .hasClass("hidden", "topic entrance modal disappears after pressing esc");- });-});diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 85799e5a258..ee9cc27894d 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -3480,7 +3480,7 @@ experimental:- disabled- auto- enabled- default: disabled+ default: autoglimmer_post_menu_mode:client: truetype: enumdiff --git a/spec/system/page_objects/components/topic_list.rb b/spec/system/page_objects/components/topic_list.rbindex 0b7e1c1f35e..144dcd8e0cc 100644--- a/spec/system/page_objects/components/topic_list.rb+++ b/spec/system/page_objects/components/topic_list.rb@@ -75,8 +75,7 @@ module PageObjectsenddef visit_topic_first_reply_via_keyboard(topic)- find("#{topic_list_item_class(topic)} button.posts-map").native.send_keys(:return)- find("#topic-entrance button.jump-top").native.send_keys(:return)+ find("#{topic_list_item_class(topic)} a.badge-posts").native.send_keys(:return)enddef topic_list_item_class(topic)@@ -94,7 +93,7 @@ module PageObjectsprivatedef topic_list_item_closed(topic)- "#{topic_list_item_class(topic)} .topic-statuses .topic-status svg.locked"+ "#{topic_list_item_class(topic)} .topic-statuses .topic-status svg.d-icon-lock"enddef topic_list_item_unread_badge(topic)