From 7aa95c9289c42df4ad2b86de90af516b7cee38b4 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Wed, 31 Jul 2019 19:07:35 +0800 Subject: [PATCH] Hide edit event. Also libQuotient refuses to compile. --- include/libQuotient | 2 +- src/messageeventmodel.cpp | 8 +++++++- src/spectralroom.cpp | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/libQuotient b/include/libQuotient index 64bea52b8..7b938d45a 160000 --- a/include/libQuotient +++ b/include/libQuotient @@ -1 +1 @@ -Subproject commit 64bea52b8672df45e5a0bd2ca54fe6a0fd97a7b2 +Subproject commit 7b938d45a7d2c2fad421e2d39f98764ac7c494c3 diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index 94cca3d59..1583dc588 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -138,7 +138,7 @@ void MessageEventModel::setRoom(SpectralRoom* room) { }); connect(m_currentRoom, &Room::updatedEvent, this, [this](const QString& eventId) { - refreshEventRoles(eventId, {ReactionRole}); + refreshEventRoles(eventId, {ReactionRole, Qt::DisplayRole}); }); connect(m_currentRoom, &Room::fileTransferProgress, this, &MessageEventModel::refreshEvent); @@ -381,6 +381,12 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const { static_cast(evt).repeatsState()) return EventStatus::Hidden; + if (auto e = eventCast(&evt)) { + if (!e->replacedEvent().isEmpty()) { + return EventStatus::Hidden; + } + } + if (m_currentRoom->connection()->isIgnored( m_currentRoom->user(evt.senderId()))) return EventStatus::Hidden; diff --git a/src/spectralroom.cpp b/src/spectralroom.cpp index f22471206..07eb772f7 100644 --- a/src/spectralroom.cpp +++ b/src/spectralroom.cpp @@ -129,6 +129,12 @@ QString SpectralRoom::lastEvent() { static_cast(*evt).repeatsState()) continue; + if (auto e = eventCast(evt)) { + if (!e->replacedEvent().isEmpty()) { + continue; + } + } + if (connection()->isIgnored(user(evt->senderId()))) continue; @@ -454,6 +460,6 @@ void SpectralRoom::toggleReaction(const QString& eventId, redactEvent(redactEventId); } } else { - postEvent(new ReactionEvent(EventRelation::annotate(eventId, reaction))); + postReaction(eventId, reaction); } }