From e97773dc978cb89514b4177edfd742f751b007b7 Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 4 Jul 2019 18:53:10 -0400 Subject: [PATCH] Sort rooms lexically --- src/qml/EventHandlers/rooms.js | 8 ++++---- src/qml/Models/Rooms.qml | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/qml/EventHandlers/rooms.js b/src/qml/EventHandlers/rooms.js index 2f9650c1..171485c2 100644 --- a/src/qml/EventHandlers/rooms.js +++ b/src/qml/EventHandlers/rooms.js @@ -82,13 +82,13 @@ function onTimelineEventReceived( "content": content, "isLocalEcho": true }, 1, 500) + if (found.length > 0) { timelines.set(found[0], item) - return + } else { + // Multiple clients will emit duplicate events with the same eventId + timelines.upsert({"eventId": event_id}, item, true, 500) } - - // Multiple clients will emit duplicate events with the same eventId - timelines.upsert({"eventId": event_id}, item, true, 500) } diff --git a/src/qml/Models/Rooms.qml b/src/qml/Models/Rooms.qml index d5f35fbb..e17fb6b4 100644 --- a/src/qml/Models/Rooms.qml +++ b/src/qml/Models/Rooms.qml @@ -2,4 +2,8 @@ import QtQuick 2.7 import SortFilterProxyModel 0.2 import "../Base" -HListModel {} +HListModel { + sorters: StringSorter { + roleName: "displayName" + } +}