FIX: system badges can be disabled (#28169) (#28171)

A previous commit mistakenly assumed system badges couldn't be disabled.

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
Penar Musaraj 2024-07-31 11:53:38 -04:00 committed by GitHub
parent 1b619b7d63
commit ac30a798f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 20 deletions

View File

@ -11,24 +11,17 @@
<span class="badge-display-name">{{data.name}}</span> <span class="badge-display-name">{{data.name}}</span>
</h1> </h1>
{{#if this.readOnly}} <form.Field
<form.Alert @icon="info-circle"> @name="enabled"
{{i18n "admin.badges.disable_system"}} @validation="required"
</form.Alert> @title={{i18n "admin.badges.status"}}
{{else}} as |field|
<form.Field >
@name="enabled" <field.Question
@disabled={{this.readOnly}} @yesLabel={{i18n "admin.badges.enabled"}}
@validation="required" @noLabel={{i18n "admin.badges.disabled"}}
@title={{i18n "admin.badges.status"}} />
as |field| </form.Field>
>
<field.Question
@yesLabel={{i18n "admin.badges.enabled"}}
@noLabel={{i18n "admin.badges.disabled"}}
/>
</form.Field>
{{/if}}
{{#if this.readOnly}} {{#if this.readOnly}}
<form.Container data-name="name" @title={{i18n "admin.badges.name"}}> <form.Container data-name="name" @title={{i18n "admin.badges.name"}}>

View File

@ -6931,7 +6931,6 @@ en:
confirm: "Yes, update password policy" confirm: "Yes, update password policy"
badges: badges:
disable_system: This badge is a system badge and cannot be disabled and/or deleted.
status: Status status: Status
title: Badges title: Badges
new_badge: New Badge new_badge: New Badge

View File

@ -16,7 +16,7 @@ describe "Admin Badges Page", type: :system do
badge = Badge.find(Badge::Autobiographer) badge = Badge.find(Badge::Autobiographer)
expect(form).to have_an_alert(I18n.t("admin_js.admin.badges.disable_system")) expect(form.field("enabled")).to be_enabled
expect(form.field("badge_type_id")).to be_disabled expect(form.field("badge_type_id")).to be_disabled
expect(form.field("badge_type_id")).to have_value(BadgeType::Bronze.to_s) expect(form.field("badge_type_id")).to have_value(BadgeType::Bronze.to_s)
expect(form.field("badge_grouping_id")).to be_disabled expect(form.field("badge_grouping_id")).to be_disabled