From f2ce910b16b2efc4aaead15e55d3739077c94c5b Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Wed, 10 May 2017 18:04:57 +0300 Subject: [PATCH] Prefer non UserId as display names --- src/ChatPage.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 8a9b29b..5751d7f 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -331,7 +331,11 @@ void ChatPage::updateRoomState(RoomState &room_state, const QJsonArray &events) if (display_name.isEmpty()) display_name = member.stateKey(); - TimelineViewManager::DISPLAY_NAMES.insert(member.stateKey(), display_name); + auto current_name = TimelineViewManager::DISPLAY_NAMES.value(member.stateKey()); + + if (current_name.isEmpty() || current_name == member.stateKey()) + TimelineViewManager::DISPLAY_NAMES.insert(member.stateKey(), display_name); + break; } case events::EventType::RoomPowerLevels: {