diff --git a/app/assets/javascripts/discourse/controllers/group-index.js.es6 b/app/assets/javascripts/discourse/controllers/group-index.js.es6 index e2b642eed3f..269ecab7cdb 100644 --- a/app/assets/javascripts/discourse/controllers/group-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-index.js.es6 @@ -1,6 +1,6 @@ import { popupAjaxError } from 'discourse/lib/ajax-error'; import Group from 'discourse/models/group'; -import { observes } from 'ember-addons/ember-computed-decorators'; +import { default as computed, observes } from 'ember-addons/ember-computed-decorators'; export default Ember.Controller.extend({ queryParams: ['order', 'desc'], @@ -14,8 +14,17 @@ export default Ember.Controller.extend({ @observes('order', 'desc') refreshMembers() { + this.set('loading', true); + this.get('model') && - this.get('model').findMembers({ order: this.get('order'), desc: this.get('desc') }); + this.get('model') + .findMembers({ order: this.get('order'), desc: this.get('desc') }) + .finally(() => this.set('loading', false)); + }, + + @computed('model.members') + hasMembers(members) { + return members && members.length > 0; }, actions: { diff --git a/app/assets/javascripts/discourse/templates/group-index.hbs b/app/assets/javascripts/discourse/templates/group-index.hbs index 889b200713d..83babdf23a2 100644 --- a/app/assets/javascripts/discourse/templates/group-index.hbs +++ b/app/assets/javascripts/discourse/templates/group-index.hbs @@ -1,4 +1,4 @@ -{{#if model.members}} +{{#if hasMembers}} {{group-membership-button model=model createNewMessageViaParams='createNewMessageViaParams'}}