mirror of https://github.com/zulip/zulip.git
settings: Add moderators option for wildcard_mention_policy in frontend.
This commit is contained in:
parent
6e672ebbee
commit
51e40dd668
|
@ -367,6 +367,14 @@ test_ui("test_wildcard_mention_allowed", () => {
|
|||
page_params.is_guest = false;
|
||||
assert(compose.wildcard_mention_allowed());
|
||||
|
||||
page_params.realm_wildcard_mention_policy =
|
||||
settings_config.wildcard_mention_policy_values.by_moderators_only.code;
|
||||
page_params.is_moderator = false;
|
||||
assert(!compose.wildcard_mention_allowed());
|
||||
|
||||
page_params.is_moderator = true;
|
||||
assert(compose.wildcard_mention_allowed());
|
||||
|
||||
page_params.realm_wildcard_mention_policy =
|
||||
settings_config.wildcard_mention_policy_values.by_stream_admins_only.code;
|
||||
page_params.is_admin = false;
|
||||
|
|
|
@ -522,6 +522,13 @@ export function wildcard_mention_allowed() {
|
|||
// TODO: Check the user's stream-level role once stream-level admins exist.
|
||||
return page_params.is_admin;
|
||||
}
|
||||
|
||||
if (
|
||||
page_params.realm_wildcard_mention_policy ===
|
||||
settings_config.wildcard_mention_policy_values.by_moderators_only.code
|
||||
) {
|
||||
return page_params.is_admin || page_params.is_moderator;
|
||||
}
|
||||
// TODO: Uncomment when we add support for stream-level administrators.
|
||||
// if (
|
||||
// page_params.realm_wildcard_mention_policy ===
|
||||
|
|
|
@ -168,11 +168,16 @@ export const wildcard_mention_policy_values = {
|
|||
code: 3,
|
||||
description: $t({defaultMessage: "Admins and full members"}),
|
||||
},
|
||||
by_moderators_only: {
|
||||
order: 4,
|
||||
code: 7,
|
||||
description: $t({defaultMessage: "Admins and moderators"}),
|
||||
},
|
||||
// Until we add stream administrators, we mislabel this choice
|
||||
// (which we intend to be the long-term default) as "Admins only"
|
||||
// and don't offer the long-term "Admins only" option.
|
||||
by_stream_admins_only: {
|
||||
order: 4,
|
||||
order: 5,
|
||||
code: 4,
|
||||
// description: $t({defaultMessage: "Organization and stream admins"}),
|
||||
description: $t({defaultMessage: "Admins only"}),
|
||||
|
|
Loading…
Reference in New Issue