From a402e85a0ff5d53d6266327d2d7bde6a0e86b595 Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Sun, 18 Apr 2021 15:32:28 -0400 Subject: [PATCH] Fix display name referenced for incorrect event types --- src/timeline/TimelineModel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 1148985b..6108df1c 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -1463,9 +1463,8 @@ TimelineModel::formatMemberEvent(QString id) } } - QString user = QString::fromStdString(event->state_key); - QString name = utils::replaceEmoji(displayName(user)); - QString oldName = QString::fromStdString(prevEvent->content.display_name); + QString user = QString::fromStdString(event->state_key); + QString name = utils::replaceEmoji(displayName(user)); QString rendered; // see table https://matrix.org/docs/spec/client_server/latest#m-room-member @@ -1476,6 +1475,8 @@ TimelineModel::formatMemberEvent(QString id) break; case Membership::Join: if (prevEvent && prevEvent->content.membership == Membership::Join) { + QString oldName = QString::fromStdString(prevEvent->content.display_name); + bool displayNameChanged = prevEvent->content.display_name != event->content.display_name; bool avatarChanged =