Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Regenerate room lists when we get RoomMember.membership
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebarnard1 committed Feb 5, 2018
1 parent 9982efb commit c665c11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/actions/MatrixActionCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ function createRoomTagsAction(matrixClient, roomTagsEvent, room) {
return { action: 'MatrixActions.Room.tags', room };
}

function createRoomMembershipAction(matrixClient, membershipEvent, member, oldMembership) {
return { action: 'MatrixActions.RoomMember.membership', member };
}

/**
* This object is responsible for dispatching actions when certain events are emitted by
* the given MatrixClient.
Expand All @@ -83,6 +87,7 @@ export default {
this._addMatrixClientListener(matrixClient, 'sync', createSyncAction);
this._addMatrixClientListener(matrixClient, 'accountData', createAccountDataAction);
this._addMatrixClientListener(matrixClient, 'Room.tags', createRoomTagsAction);
this._addMatrixClientListener(matrixClient, 'RoomMember.membership', createRoomMembershipAction);
},

/**
Expand Down
5 changes: 5 additions & 0 deletions src/stores/RoomListStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ class RoomListStore extends Store {
this._generateRoomLists();
}
break;
case 'MatrixActions.RoomMember.membership': {
if (!this._matrixClient || payload.member.userId !== this._matrixClient.credentials.userId) break;
this._generateRoomLists();
}
break;
case 'RoomListActions.tagRoom.pending': {
this._updateRoomListsOptimistic(
payload.request.room,
Expand Down

0 comments on commit c665c11

Please sign in to comment.