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