From 6cce839f0ade427a565ba318cc98a78a465d0bc4 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 16 Apr 2018 09:09:47 +0800 Subject: [PATCH] FIX: Missing action to trigger add group members modal for group owners. https://meta.discourse.org/t/unable-to-add-members-to-a-group-as-group-owner-who-is-not-staff/85346?u=tgxworld --- .../discourse/templates/group-index.hbs | 1 + .../acceptance/group-index-test.js.es6 | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/templates/group-index.hbs b/app/assets/javascripts/discourse/templates/group-index.hbs index c0cf37140c7..ee9f4c8659f 100644 --- a/app/assets/javascripts/discourse/templates/group-index.hbs +++ b/app/assets/javascripts/discourse/templates/group-index.hbs @@ -10,6 +10,7 @@ showBulkAddModal="showBulkAddModal"}} {{else}} {{d-button icon="plus" + action="showAddMembersModal" label="groups.add_members.title" class="group-members-add"}} {{/if}} diff --git a/test/javascripts/acceptance/group-index-test.js.es6 b/test/javascripts/acceptance/group-index-test.js.es6 index caa0a3b8d9d..dbb768639c2 100644 --- a/test/javascripts/acceptance/group-index-test.js.es6 +++ b/test/javascripts/acceptance/group-index-test.js.es6 @@ -1,4 +1,4 @@ -import { acceptance, logIn } from "helpers/qunit-helpers"; +import { acceptance, logIn, replaceCurrentUser } from "helpers/qunit-helpers"; acceptance("Group Members"); @@ -22,6 +22,22 @@ QUnit.test("Viewing Members as anon user", assert => { }); }); +QUnit.test("Viewing Members as a group owner", assert => { + logIn(); + Discourse.reset(); + replaceCurrentUser({ admin: false, staff: false }); + + visit("/groups/discourse"); + click('.group-members-add'); + + andThen(() => { + assert.equal( + find('#group-add-members-user-selector').length, 1, + 'it should display the add members modal' + ); + }); +}); + QUnit.test("Viewing Members as an admin user", assert => { logIn(); Discourse.reset();