From e9237a46bbdf6cbfee23c4f1acc06d90251566b0 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 23 Jul 2020 11:58:54 +0200 Subject: Room::P::isEventNotable(): edits are not notable Edits are (normally) applied to some other event up the timeline, therefore not displayed. Having [1] in unread counts while seeing nothing in the timeline is quite confusing. --- lib/room.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/room.cpp b/lib/room.cpp index 5a4a8611..3dd366f8 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -241,7 +241,8 @@ public: bool isEventNotable(const TimelineItem& ti) const { return !ti->isRedacted() && ti->senderId() != connection->userId() - && is(*ti); + && is(*ti) + && ti.viewAs()->replacedEvent().isEmpty(); } template @@ -700,7 +701,7 @@ Room::Changes Room::Private::promoteReadMarker(User* u, rev_iter_t newMarker, et.start(); unreadMessages = int(count_if(eagerMarker, timeline.cend(), - std::bind(&Room::Private::isEventNotable, this, _1))); + [this](const auto& ti) { return isEventNotable(ti); })); if (et.nsecsElapsed() > profilerMinNsecs() / 10) qCDebug(PROFILER) << "Recounting unread messages took" << et; @@ -2240,10 +2241,10 @@ Room::Changes Room::Private::addNewMessageEvents(RoomEvents&& events) }); if (targetIt != it) *targetIt = makeReplaced(**targetIt, *msg); - else // FIXME: don't ignore, just show it wherever it arrived + else // FIXME: hide the replacing event when target arrives later qCDebug(EVENTS) << "Replacing event" << msg->id() - << "ignored: replaced event" << msg->replacedEvent() + << "ignored: target event" << msg->replacedEvent() << "is not found"; // Same as with redactions above, the replaced event coming // later will come already with the new content. -- cgit v1.2.3