aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-12 09:26:09 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-12 09:26:09 +0200
commitfc0fdf2ed6006c11ffd47675fabb1232721c5e7d (patch)
treeaf0a5b9a7a795d83d8eff2d1f1101559e035519d
parenta1e885177bd9421a8ede4bec870a8fdc8b89a693 (diff)
downloadlibquotient-fc0fdf2ed6006c11ffd47675fabb1232721c5e7d.tar.gz
libquotient-fc0fdf2ed6006c11ffd47675fabb1232721c5e7d.zip
RoomMemberEvent::is*(): fix comparison against Omittable
Closes #514.
-rw-r--r--lib/events/roommemberevent.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/events/roommemberevent.cpp b/lib/events/roommemberevent.cpp
index 8a6bddd8..469dbb32 100644
--- a/lib/events/roommemberevent.cpp
+++ b/lib/events/roommemberevent.cpp
@@ -103,16 +103,14 @@ bool RoomMemberEvent::isUnban() const
bool RoomMemberEvent::isRename() const
{
- auto prevName = prevContent() && prevContent()->displayName
- ? *prevContent()->displayName
- : QString();
- return newDisplayName() != prevName;
+ return prevContent() && prevContent()->displayName
+ ? newDisplayName() != *prevContent()->displayName
+ : newDisplayName().has_value();
}
bool RoomMemberEvent::isAvatarUpdate() const
{
- auto prevAvatarUrl = prevContent() && prevContent()->avatarUrl
- ? *prevContent()->avatarUrl
- : QUrl();
- return newAvatarUrl() != prevAvatarUrl;
+ return prevContent() && prevContent()->avatarUrl
+ ? newAvatarUrl() != *prevContent()->avatarUrl
+ : newAvatarUrl().has_value();
}