Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Quotient/events/roomevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

using namespace Quotient;

RoomEvent::RoomEvent(const QJsonObject& json) : Event(json)
RoomEvent::RoomEvent(const QJsonObject &json) : Event(json), _id(fullJson()[EventIdKey].toString())
{
if (const auto redaction = unsignedPart<QJsonObject>(RedactedCauseKey);
!redaction.isEmpty())
Expand All @@ -22,7 +22,7 @@ RoomEvent::~RoomEvent() = default; // Let the smart pointer do its job

QString RoomEvent::displayId() const { return id().isEmpty() ? transactionId() : id(); }

QString RoomEvent::id() const { return fullJson()[EventIdKey].toString(); }
QString RoomEvent::id() const { return _id; }

QDateTime RoomEvent::originTimestamp() const
{
Expand Down Expand Up @@ -79,6 +79,7 @@ void RoomEvent::addId(const QString& newId)
Q_ASSERT(id().isEmpty());
Q_ASSERT(!newId.isEmpty());
editJson().insert(EventIdKey, newId);
_id = newId;
qCDebug(EVENTS) << "Event txnId -> id:" << transactionId() << "->" << id();
Q_ASSERT(id() == newId);
}
Expand Down
2 changes: 2 additions & 0 deletions Quotient/events/roomevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class QUOTIENT_API RoomEvent : public Event {
void dumpTo(QDebug dbg) const override;

private:
QString _id;

// RedactionEvent is an incomplete type here so we cannot inline
// constructors using it and also destructors (with 'using', in particular).
event_ptr_tt<RedactionEvent> _redactedBecause;
Expand Down