mirror of
https://github.com/discourse/discourse.git
synced 2024-12-20 06:05:48 +08:00
UX: only show automatic group tooltip to admins (#30155)
Follow up to #28630 which added the tooltip on automatic group. It was missing a check to ensure the current user is an admin, since only admins can manage automatic groups. Reported in https://meta.discourse.org/t/324215 by @moin-Jana
This commit is contained in:
parent
4f4498994c
commit
35ecd0335c
|
@ -41,7 +41,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if this.model.automatic}}
|
||||
{{#if (and this.currentUser.admin this.model.automatic)}}
|
||||
<DTooltip class="admin-group-automatic-tooltip">
|
||||
<:trigger>
|
||||
{{d-icon "gear"}}
|
||||
|
|
|
@ -24,6 +24,24 @@ acceptance("Managing Group Membership", function (needs) {
|
|||
);
|
||||
});
|
||||
|
||||
test("As an admin on an automatic group", async function (assert) {
|
||||
await visit("/g/moderators");
|
||||
|
||||
assert
|
||||
.dom(".admin-group-automatic-tooltip")
|
||||
.exists("displays automatic tooltip");
|
||||
});
|
||||
|
||||
test("As a non-admin user on an automatic group", async function (assert) {
|
||||
updateCurrentUser({ admin: false });
|
||||
|
||||
await visit("/g/moderators");
|
||||
|
||||
assert
|
||||
.dom(".admin-group-automatic-tooltip")
|
||||
.doesNotExist("does not display automatic tooltip");
|
||||
});
|
||||
|
||||
test("As an admin", async function (assert) {
|
||||
updateCurrentUser({ can_create_group: true });
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user