From df6c152fa1ab0f831f2b3ced281baed6f50e812d Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Tue, 27 Aug 2024 09:47:19 +1000 Subject: [PATCH] UX: flag settings tab to follow UI guidelines (#28479) Add settings tab to flags moderation page. --- .../admin-config-areas/flags-settings.gjs | 47 +++++++++++++++++++ .../components/admin-config-areas/flags.gjs | 36 +++++--------- .../admin-config-flags-settings.js | 12 +++++ .../addon/controllers/admin-config-flags.js | 12 +++++ .../addon/routes/admin-config-flags-edit.js | 9 +++- .../routes/admin-config-flags-settings.js | 8 ++++ .../admin/addon/routes/admin-route-map.js | 1 + .../addon/templates/config-flags-settings.hbs | 5 ++ .../admin/addon/templates/config-flags.hbs | 28 +++++++++++ .../stylesheets/common/admin/settings.scss | 1 + config/locales/client.en.yml | 2 + spec/system/admin_flags_spec.rb | 25 ++++++++++ .../page_objects/components/admin-header.rb | 11 +++++ spec/system/page_objects/pages/admin_flags.rb | 5 ++ 14 files changed, 177 insertions(+), 25 deletions(-) create mode 100644 app/assets/javascripts/admin/addon/components/admin-config-areas/flags-settings.gjs create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-config-flags-settings.js create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-config-flags.js create mode 100644 app/assets/javascripts/admin/addon/routes/admin-config-flags-settings.js create mode 100644 app/assets/javascripts/admin/addon/templates/config-flags-settings.hbs create mode 100644 app/assets/javascripts/admin/addon/templates/config-flags.hbs create mode 100644 spec/system/page_objects/components/admin-header.rb diff --git a/app/assets/javascripts/admin/addon/components/admin-config-areas/flags-settings.gjs b/app/assets/javascripts/admin/addon/components/admin-config-areas/flags-settings.gjs new file mode 100644 index 00000000000..5d465480370 --- /dev/null +++ b/app/assets/javascripts/admin/addon/components/admin-config-areas/flags-settings.gjs @@ -0,0 +1,47 @@ +import Component from "@glimmer/component"; +import { tracked } from "@glimmer/tracking"; +import didInsert from "@ember/render-modifiers/modifiers/did-insert"; +import { service } from "@ember/service"; +import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item"; +import SiteSettingFilter from "discourse/lib/site-setting-filter"; +import i18n from "discourse-common/helpers/i18n"; +import { bind } from "discourse-common/utils/decorators"; +import AdminFilteredSiteSettings from "admin/components/admin-filtered-site-settings"; +import SiteSetting from "admin/models/site-setting"; + +export default class AdminConfigAreasFlagsSettings extends Component { + @service siteSettings; + @tracked settings; + + @bind + loadSettings() { + SiteSetting.findAll({ + categories: ["spam", "rate_limits", "chat"], + }).then((settings) => { + this.settings = new SiteSettingFilter(settings).performSearch( + "flags", + {} + ); + }); + } + + +} diff --git a/app/assets/javascripts/admin/addon/components/admin-config-areas/flags.gjs b/app/assets/javascripts/admin/addon/components/admin-config-areas/flags.gjs index b5ba12975fd..0c7a08bcd14 100644 --- a/app/assets/javascripts/admin/addon/components/admin-config-areas/flags.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-config-areas/flags.gjs @@ -2,14 +2,13 @@ import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; import { action } from "@ember/object"; import { service } from "@ember/service"; -import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { SYSTEM_FLAG_IDS } from "discourse/lib/constants"; import i18n from "discourse-common/helpers/i18n"; import { bind } from "discourse-common/utils/decorators"; import AdminFlagItem from "admin/components/admin-flag-item"; -import AdminPageHeader from "admin/components/admin-page-header"; +import AdminPageSubheader from "admin/components/admin-page-subheader"; export default class AdminConfigAreasFlags extends Component { @service site; @@ -70,28 +69,19 @@ export default class AdminConfigAreasFlags extends Component { }