sort rooms by latest event and fix scrolling at reloading

matrix-chat-native
adb 4 years ago
parent f5388abeb0
commit a67fa94447

@ -52,7 +52,7 @@ export default {
this.loadingStatus = 'loading ...'; this.loadingStatus = 'loading ...';
await matrix.client.paginateEventTimeline(this.room.getLiveTimeline(), {backwards: true}) await matrix.client.paginateEventTimeline(this.room.getLiveTimeline(), {backwards: true})
.then(state => this.loadingStatus = state?'load more':false); .then(state => this.loadingStatus = state?'load more':false);
this.scroll.setScrollBottom(scrollBottom); if (this.loadingStatus) this.scroll.setScrollBottom(scrollBottom);
}, },
getUser(userId){ getUser(userId){
return matrix.client.getUser(userId); return matrix.client.getUser(userId);

@ -6,7 +6,11 @@
<div id="roomList" class="roomList"> <div id="roomList" class="roomList">
<h1 class="wideElement">[chat]</h1><h1 class="smallElement">[c]</h1> <h1 class="wideElement">[chat]</h1><h1 class="smallElement">[c]</h1>
<input v-model="search" class="input wideElement" type="text" maxlength="50" placeholder="search"> <input v-model="search" class="input wideElement" type="text" maxlength="50" placeholder="search">
<div v-for="room in matrix.rooms" :key="room.roomId" @click="openChat(room)" > <div
v-for="room in Object.assign([], matrix.rooms)
.sort(obj => obj.timeline[obj.timeline.length-1].event.origin_server_ts)"
:key="room.roomId" @click="openChat(room)"
>
<room-list-element <room-list-element
v-if="!search || room.name.toLowerCase().includes(search.toLowerCase().trim())" v-if="!search || room.name.toLowerCase().includes(search.toLowerCase().trim())"
:room="room" :room="room"

Loading…
Cancel
Save