mirror of
https://github.com/discourse/discourse.git
synced 2025-09-04 08:47:37 +08:00
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:
parent
65c000ad74
commit
bb85795934
2 changed files with 8 additions and 1 deletions
|
@ -15,7 +15,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
@computed("model.is_group_user", "model.id", "groupUserIds")
|
@computed("model.is_group_user", "model.id", "groupUserIds")
|
||||||
userIsGroupUser(isGroupUser, groupId, groupUserIds) {
|
userIsGroupUser(isGroupUser, groupId, groupUserIds) {
|
||||||
if (isGroupUser) {
|
if (isGroupUser !== undefined) {
|
||||||
return isGroupUser;
|
return isGroupUser;
|
||||||
} else {
|
} else {
|
||||||
return !!groupUserIds && groupUserIds.includes(groupId);
|
return !!groupUserIds && groupUserIds.includes(groupId);
|
||||||
|
|
|
@ -58,4 +58,11 @@ test('userIsGroupUser', function() {
|
||||||
this.subject().set('groupUserIds', undefined);
|
this.subject().set('groupUserIds', undefined);
|
||||||
|
|
||||||
equal(this.subject().get('userIsGroupUser'), false);
|
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);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue