From ed0b345e7696225243d808d591d29bd25d497aea Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Mon, 26 Mar 2018 22:02:53 +0300 Subject: [PATCH] Pin invites to the top of the room list fixes #252 --- src/RoomInfoListItem.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/RoomInfoListItem.cc b/src/RoomInfoListItem.cc index 8041915..da896bc 100644 --- a/src/RoomInfoListItem.cc +++ b/src/RoomInfoListItem.cc @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -84,6 +85,15 @@ RoomInfoListItem::RoomInfoListItem(QString room_id, { init(parent); + // HACK + // We use fake message info with an old date to pin + // the invite events to the top. + // + // State events in invited rooms don't contain timestamp info, + // so we can't use them for sorting. + auto now = QDateTime::currentDateTime(); + lastMsgInfo_ = {"-", "-", "-", "-", now.addYears(10)}; + roomAvatar_ = QString::fromStdString(invitedRoom_.avatar()); roomName_ = QString::fromStdString(invitedRoom_.name()); }