mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
78d2ebdb6b
@ -163,6 +163,26 @@ function createRoomMembershipAction(matrixClient, membershipEvent, member, oldMe
|
|||||||
return { action: 'MatrixActions.RoomMember.membership', member };
|
return { action: 'MatrixActions.RoomMember.membership', member };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef EventDecryptedAction
|
||||||
|
* @type {Object}
|
||||||
|
* @property {string} action 'MatrixActions.Event.decrypted'.
|
||||||
|
* @property {MatrixEvent} event the matrix event that was decrypted.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a MatrixActions.Event.decrypted action that represents
|
||||||
|
* a MatrixClient `Event.decrypted` matrix event, emitted when a
|
||||||
|
* matrix event is decrypted.
|
||||||
|
*
|
||||||
|
* @param {MatrixClient} matrixClient the matrix client.
|
||||||
|
* @param {MatrixEvent} event the matrix event that was decrypted.
|
||||||
|
* @returns {EventDecryptedAction} an action of type `MatrixActions.Event.decrypted`.
|
||||||
|
*/
|
||||||
|
function createEventDecryptedAction(matrixClient, event) {
|
||||||
|
return { action: 'MatrixActions.Event.decrypted', event };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This object is responsible for dispatching actions when certain events are emitted by
|
* This object is responsible for dispatching actions when certain events are emitted by
|
||||||
* the given MatrixClient.
|
* the given MatrixClient.
|
||||||
@ -183,6 +203,7 @@ export default {
|
|||||||
this._addMatrixClientListener(matrixClient, 'Room.tags', createRoomTagsAction);
|
this._addMatrixClientListener(matrixClient, 'Room.tags', createRoomTagsAction);
|
||||||
this._addMatrixClientListener(matrixClient, 'Room.timeline', createRoomTimelineAction);
|
this._addMatrixClientListener(matrixClient, 'Room.timeline', createRoomTimelineAction);
|
||||||
this._addMatrixClientListener(matrixClient, 'RoomMember.membership', createRoomMembershipAction);
|
this._addMatrixClientListener(matrixClient, 'RoomMember.membership', createRoomMembershipAction);
|
||||||
|
this._addMatrixClientListener(matrixClient, 'Event.decrypted', createEventDecryptedAction);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,6 +87,20 @@ class RoomListStore extends Store {
|
|||||||
this._generateRoomLists();
|
this._generateRoomLists();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// When an event is decrypted, it could mean we need to reorder the room
|
||||||
|
// list because we now know the type of the event.
|
||||||
|
case 'MatrixActions.Event.decrypted': {
|
||||||
|
const room = this._matrixClient.getRoom(payload.event.getRoomId());
|
||||||
|
const liveTimeline = room.getLiveTimeline();
|
||||||
|
const eventTimeline = room.getTimelineForEvent(payload.event.getId());
|
||||||
|
|
||||||
|
if (!this._state.ready ||
|
||||||
|
liveTimeline !== eventTimeline ||
|
||||||
|
!this._eventTriggersRecentReorder(payload.event)
|
||||||
|
) break;
|
||||||
|
this._generateRoomLists();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'MatrixActions.accountData': {
|
case 'MatrixActions.accountData': {
|
||||||
if (payload.event_type !== 'm.direct') break;
|
if (payload.event_type !== 'm.direct') break;
|
||||||
this._generateRoomLists();
|
this._generateRoomLists();
|
||||||
|
Loading…
Reference in New Issue
Block a user