FIX: Leave group membership button not updating.

https://meta.discourse.org/t/leave-group-button-on-groups-page-doesnt-give-any-feedback/57359/4
This commit is contained in:
Guo Xiang Tan 2017-03-16 11:33:55 +08:00
parent 65c000ad74
commit bb85795934
2 changed files with 8 additions and 1 deletions

View File

@ -15,7 +15,7 @@ export default Ember.Component.extend({
@computed("model.is_group_user", "model.id", "groupUserIds")
userIsGroupUser(isGroupUser, groupId, groupUserIds) {
if (isGroupUser) {
if (isGroupUser !== undefined) {
return isGroupUser;
} else {
return !!groupUserIds && groupUserIds.includes(groupId);

View File

@ -58,4 +58,11 @@ test('userIsGroupUser', function() {
this.subject().set('groupUserIds', undefined);
equal(this.subject().get('userIsGroupUser'), false);
this.subject().setProperties({
groupUserIds: [1, 3],
model: { id: 1, is_group_user: false }
});
equal(this.subject().get('userIsGroupUser'), false);
});