aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-07-23 11:58:54 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-07-23 11:58:54 +0200
commite9237a46bbdf6cbfee23c4f1acc06d90251566b0 (patch)
tree731bd23daa2c9cc3d5bf80ec45179dea7cf427c9 /lib
parent894755776f0d100032eb4346ea4a1f07defb61cb (diff)
downloadlibquotient-e9237a46bbdf6cbfee23c4f1acc06d90251566b0.tar.gz
libquotient-e9237a46bbdf6cbfee23c4f1acc06d90251566b0.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp9
1 files 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<RoomMessageEvent>(*ti);
+ && is<RoomMessageEvent>(*ti)
+ && ti.viewAs<RoomMessageEvent>()->replacedEvent().isEmpty();
}
template <typename EventArrayT>
@@ -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.