FEATURE - Moderators can create and manage groups (#10432)

Enabling the moderators_manage_categories_and_groups site setting will allow moderator users to create/manage groups.

* show New Group form to moderators

* Allow moderators to update groups and read logs, where appropriate

* Rename site setting from create -> manage

* improved tests

* Migration should rename old log entries

* Log group changes, even if those changes mean you can no longer see the group

* Slight reshuffle

* RouteTo /g if they no longer have permissions to view group
This commit is contained in:
jbrw
2020-08-19 10:41:40 -04:00
committed by GitHub
parent 3640c00b03
commit aa1fc01307
29 changed files with 241 additions and 32 deletions
@@ -8,7 +8,13 @@ acceptance("Managing Group Interaction Settings", {
});
QUnit.test("As an admin", async assert => {
await visit("/g/discourse/manage/interaction");
updateCurrentUser({
moderator: false,
admin: true,
can_create_group: true
});
await visit("/g/alternative-group/manage/interaction");
assert.equal(
find(".groups-form-visibility-level").length,
@@ -42,13 +48,18 @@ QUnit.test("As an admin", async assert => {
});
QUnit.test("As a group owner", async assert => {
updateCurrentUser({ moderator: false, admin: false });
updateCurrentUser({
moderator: false,
admin: false,
can_create_group: false
});
await visit("/g/discourse/manage/interaction");
assert.equal(
find(".groups-form-visibility-level").length,
0,
"it should display visibility level selector"
"it should not display visibility level selector"
);
assert.equal(
@@ -6,7 +6,9 @@ acceptance("Managing Group Membership", {
});
QUnit.test("As an admin", async assert => {
await visit("/g/discourse/manage/membership");
updateCurrentUser({ can_create_group: true });
await visit("/g/alternative-group/manage/membership");
assert.ok(
find('label[for="automatic_membership"]').length === 1,
@@ -34,7 +34,11 @@ QUnit.test("As an admin", async assert => {
});
QUnit.test("As a group owner", async assert => {
updateCurrentUser({ moderator: false, admin: false });
updateCurrentUser({
moderator: false,
admin: false,
can_create_group: false
});
await visit("/g/discourse/manage/profile");