Show the time when we were invited on the invite page

Currently, this is something that's missing even in clients like Element
(!?!) I will sometimes miss when invites are sent - like when I'm
sleeping - and then when I start back up NeoChat I have no idea when
they tried to invite me. This can get worse on bigger timescales, like
when you go on vacation for a few days.
This commit is contained in:
Joshua Goins
2025-05-08 14:22:55 -04:00
parent d7c9bea783
commit 28c39292f7
3 changed files with 24 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
updatePushNotificationState(u"m.push_rules"_s);
Q_EMIT canEncryptRoomChanged();
Q_EMIT inviteTimestampChanged();
},
Qt::SingleShotConnection);
connect(this, &Room::changed, this, [this] {
@@ -1665,6 +1666,15 @@ QString NeoChatRoom::invitingUserId() const
return event->senderId();
}
QDateTime NeoChatRoom::inviteTimestamp() const
{
auto event = currentState().get<RoomMemberEvent>(connection()->userId());
if (!event) {
return {};
}
return event->originTimestamp();
}
void NeoChatRoom::setRoomState(const QString &type, const QString &stateKey, const QByteArray &content)
{
setState(type, stateKey, QJsonDocument::fromJson(content).object());