diff --git a/app/assets/javascripts/discourse/components/group-membership-button.js.es6 b/app/assets/javascripts/discourse/components/group-membership-button.js.es6 index ff8ceb0dcf4..dba83c69dc2 100644 --- a/app/assets/javascripts/discourse/components/group-membership-button.js.es6 +++ b/app/assets/javascripts/discourse/components/group-membership-button.js.es6 @@ -41,10 +41,6 @@ export default Ember.Component.extend({ this.set('updatingMembership', true); const model = this.get('model'); - if (!!(this.currentUser)) { - - } - model.addMembers(this.currentUser.get('username')).then(() => { model.set('is_group_user', true); }).catch(popupAjaxError).finally(() => { diff --git a/app/assets/javascripts/discourse/models/group.js.es6 b/app/assets/javascripts/discourse/models/group.js.es6 index 36a1359bbed..99c95caf61a 100644 --- a/app/assets/javascripts/discourse/models/group.js.es6 +++ b/app/assets/javascripts/discourse/models/group.js.es6 @@ -111,7 +111,7 @@ const Group = RestModel.extend({ @observes("visible", "canEveryoneMention") _updateAllowMembershipRequests() { if (!this.get('visible') || !this.get('canEveryoneMention')) { - this.set('allow_membership_requests', false); + this.set ('allow_membership_requests', false); } }, diff --git a/test/javascripts/acceptance/groups-test.js.es6 b/test/javascripts/acceptance/groups-test.js.es6 index 1c9d5d8d872..baf138e76d0 100644 --- a/test/javascripts/acceptance/groups-test.js.es6 +++ b/test/javascripts/acceptance/groups-test.js.es6 @@ -7,8 +7,26 @@ test("Browsing Groups", () => { andThen(() => { equal(count('.groups-table-row'), 2, 'it displays visible groups'); - equal(find('.group-index-join').length, 1, 'it show button to join group'); - equal(find('.group-index-request').length, 1, 'it show button to request for group membership'); + equal(find('.group-index-join').length, 1, 'it shows button to join group'); + equal(find('.group-index-request').length, 1, 'it shows button to request for group membership'); + }); + + click('.group-index-join'); + + andThen(() => { + ok(exists('.modal.login-modal'), 'it shows the login modal'); + }); + + click('.login-modal .close'); + + andThen(() => { + ok(invisible('.modal.login-modal'), 'it closes the login modal'); + }); + + click('.group-index-request'); + + andThen(() => { + ok(exists('.modal.login-modal'), 'it shows the login modal'); }); click("a[href='/groups/discourse/members']"); @@ -16,6 +34,12 @@ test("Browsing Groups", () => { andThen(() => { equal(find('.group-info-name').text().trim(), 'Awesome Team', "it displays the group page"); }); + + click('.group-index-join'); + + andThen(() => { + ok(exists('.modal.login-modal'), 'it shows the login modal'); + }); }); test("Viewing Group", () => { diff --git a/test/javascripts/fixtures/group-fixtures.js.es6 b/test/javascripts/fixtures/group-fixtures.js.es6 index 84b472251fc..92ecb7c48be 100644 --- a/test/javascripts/fixtures/group-fixtures.js.es6 +++ b/test/javascripts/fixtures/group-fixtures.js.es6 @@ -8,6 +8,7 @@ export default { "user_count":8, "alias_level":0, "visible":true, + "public":true, "flair_url": 'fa-adjust', "is_group_owner":true }