From 71185be83b646c7d5a2d6d3dc0306710e1f6fdd0 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 11 Dec 2017 19:24:38 +0900 Subject: Whitelist origin_server_ts in redaction logic The Spec doesn't mention it but both Synapse and Riot act as if origin_server_ts was whitelisted, and it was also confirmed in #matrix-dev to be reasonable behaviour. --- events/event.cpp | 4 ++-- room.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/events/event.cpp b/events/event.cpp index d779f293..354aed03 100644 --- a/events/event.cpp +++ b/events/event.cpp @@ -87,6 +87,8 @@ RoomEvent::RoomEvent(Event::Type type) : Event(type) { } RoomEvent::RoomEvent(Type type, const QJsonObject& rep) : Event(type, rep), _id(rep["event_id"].toString()) , _roomId(rep["room_id"].toString()) + , _serverTimestamp( + QMatrixClient::fromJson(rep["origin_server_ts"])) , _senderId(rep["sender"].toString()) { // if (_id.isEmpty()) @@ -112,8 +114,6 @@ RoomEvent::RoomEvent(Type type, const QJsonObject& rep) return; } - _serverTimestamp = - QMatrixClient::fromJson(rep["origin_server_ts"]); _txnId = unsignedData.value("transactionId").toString(); if (!_txnId.isEmpty()) qCDebug(EVENTS) << "Event transactionId:" << _txnId; diff --git a/room.cpp b/room.cpp index dfca6bde..7f4d7684 100644 --- a/room.cpp +++ b/room.cpp @@ -716,7 +716,7 @@ void Room::Private::processRedaction(const RedactionEvent* redaction) } static const QStringList keepKeys = { "event_id", "type", "room_id", "sender", "state_key", - "prev_content", "content" }; + "prev_content", "content", "origin_server_ts" }; static const std::vector> keepContentKeysMap { { Event::Type::RoomMember, { "membership" } } -- cgit v1.2.3