DEV: replaces topic-notifications-options by DMenu (#30298)

This commit introduces <NotificationsTracking /> which is a wrapper component around <DMenu /> which replaces the select-kit component <TopicNotificationsButton />.

Each tracking case has its dedicated component:

- topic -> `<TopicNotificationsTracking />`
- group -> `<GroupNotificationsTracking />`
- tag -> `<TagNotificationsTracking />`
- category -> `<CategoryNotificationsTracking />`
- chat thread -> `<ThreadNotificationsTracking />`
This commit is contained in:
Joffrey JAFFEUX
2024-12-16 19:59:18 +01:00
committed by GitHub
parent 062e4fb4f3
commit 41df705188
38 changed files with 565 additions and 289 deletions

View File

@ -1,5 +1,4 @@
import { hash } from "@ember/helper";
import CategoryNotificationsButton from "select-kit/components/category-notifications-button";
import CategoryNotificationsTracking from "discourse/components/category-notifications-tracking";
import BaseField from "./da-base-field";
import DAFieldDescription from "./da-field-description";
import DAFieldLabel from "./da-field-label";
@ -11,10 +10,9 @@ export default class CategoryNotficationLevelField extends BaseField {
<DAFieldLabel @label={{@label}} @field={{@field}} />
<div class="controls">
<CategoryNotificationsButton
@value={{@field.metadata.value}}
<CategoryNotificationsTracking
@levelId={{@field.metadata.value}}
@onChange={{this.mutValue}}
@options={{hash showFullTitle=true}}
/>
<DAFieldDescription @description={{@description}} />

View File

@ -3,7 +3,7 @@ import { render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import notificationsTracking from "discourse/tests/helpers/notifications-tracking-helper";
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
module(
@ -23,9 +23,7 @@ module(
await render(
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
);
await selectKit().expand();
await selectKit().selectRowByValue(2);
await notificationsTracking().selectLevelId(2);
assert.strictEqual(this.field.metadata.value, 2);
});