mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-09 00:30:28 +03:00
refectored Drawer component and added Postie
This commit is contained in:
parent
8996b562bc
commit
b5dfc337ec
10 changed files with 336 additions and 191 deletions
|
|
@ -155,12 +155,13 @@ class RoomList extends EventEmitter {
|
|||
this.matrixClient.on('Room.name', () => {
|
||||
this.emit(cons.events.roomList.ROOMLIST_UPDATED);
|
||||
});
|
||||
this.matrixClient.on('Room.receipt', (event) => {
|
||||
this.matrixClient.on('Room.receipt', (event, room) => {
|
||||
if (event.getType() === 'm.receipt') {
|
||||
const evContent = event.getContent();
|
||||
const userId = Object.keys(evContent[Object.keys(evContent)[0]]['m.read'])[0];
|
||||
if (userId !== this.matrixClient.getUserId()) return;
|
||||
this.emit(cons.events.roomList.ROOMLIST_UPDATED);
|
||||
const content = event.getContent();
|
||||
const userReadEventId = Object.keys(content)[0];
|
||||
const eventReaderUserId = Object.keys(content[userReadEventId]['m.read'])[0];
|
||||
if (eventReaderUserId !== this.matrixClient.getUserId()) return;
|
||||
this.emit(cons.events.roomList.MY_RECEIPT_ARRIVED, room.roomId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -280,8 +281,13 @@ class RoomList extends EventEmitter {
|
|||
this.emit(cons.events.roomList.ROOMLIST_UPDATED);
|
||||
});
|
||||
|
||||
this.matrixClient.on('Room.timeline', () => {
|
||||
this.emit(cons.events.roomList.ROOMLIST_UPDATED);
|
||||
this.matrixClient.on('Room.timeline', (event, room) => {
|
||||
const supportEvents = ['m.room.message', 'm.room.encrypted', 'm.sticker'];
|
||||
if (!supportEvents.includes(event.getType())) return;
|
||||
|
||||
const lastTimelineEvent = room.timeline[room.timeline.length - 1];
|
||||
if (lastTimelineEvent.getId() !== event.getId()) return;
|
||||
this.emit(cons.events.roomList.EVENT_ARRIVED, room.roomId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue