FIX: missing default notification level on group creation (#11512)

This commit is contained in:
Penar Musaraj 2020-12-16 15:52:34 -05:00 committed by GitHub
parent e7b837e7e1
commit 9870a0b6a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import Component from "@ember/component"; import Component from "@ember/component";
import I18n from "I18n"; import I18n from "I18n";
import { NotificationLevels } from "discourse/lib/notification-levels";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { or } from "@ember/object/computed"; import { or } from "@ember/object/computed";
@ -46,6 +47,8 @@ export default Component.extend({
{ name: I18n.t("groups.alias_levels.owners_mods_and_admins"), value: 4 }, { name: I18n.t("groups.alias_levels.owners_mods_and_admins"), value: 4 },
{ name: I18n.t("groups.alias_levels.everyone"), value: 99 }, { name: I18n.t("groups.alias_levels.everyone"), value: 99 },
]; ];
this.watchingNotificationLevel = NotificationLevels.WATCHING;
}, },
membersVisibilityLevel: or( membersVisibilityLevel: or(
@ -63,6 +66,11 @@ export default Component.extend({
"aliasLevelOptions.firstObject.value" "aliasLevelOptions.firstObject.value"
), ),
defaultNotificationLevel: or(
"model.default_notification_level",
"watchingNotificationLevel"
),
@discourseComputed( @discourseComputed(
"siteSettings.email_in", "siteSettings.email_in",
"model.automatic", "model.automatic",

View File

@ -94,10 +94,11 @@
<label>{{i18n "groups.notification_level"}}</label> <label>{{i18n "groups.notification_level"}}</label>
{{notifications-button {{notifications-button
value=model.default_notification_level value=defaultNotificationLevel
class="groups-form-default-notification-level" class="groups-form-default-notification-level"
options=(hash options=(hash
i18nPrefix="groups.notifications" i18nPrefix="groups.notifications"
) )
onChange=(action (mut model.default_notification_level))
}} }}
</div> </div>

View File

@ -74,5 +74,12 @@ acceptance("New Group - Authenticated", function (needs) {
0, 0,
"it should disable the membership requests checkbox" "it should disable the membership requests checkbox"
); );
assert.ok(
queryAll(".groups-form-default-notification-level .selected-name .name")
.text()
.trim() === I18n.t("groups.notifications.watching.title"),
"it has a default selection for notification level"
);
}); });
}); });