From 6929089fea7cf79ae5ca9e05486ba33b0e5b216d Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 4 Apr 2026 00:40:55 +0200 Subject: update --- src/Models/RoomEvent.php | 12 +++++++++++- src/Models/User.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/Models') diff --git a/src/Models/RoomEvent.php b/src/Models/RoomEvent.php index 96dc204..ce74cac 100644 --- a/src/Models/RoomEvent.php +++ b/src/Models/RoomEvent.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Database; +use Matrix\Data\UnsignedData; use Matrix\Enums\EventType; use Matrix\Events\ClientEvent; use Matrix\Events\StateEvent; @@ -19,6 +20,15 @@ class RoomEvent */ public static function transformEvent(array $row): ClientEvent { + $rowUnsigned = json_decode($row["unsigned"], true); + $unsigned = new UnsignedData( + age: $row["age"] ?? null, + membership: $row["membership"] ?? null, + previousContent: $row["previous_content"] ?? null, + redactedBecause: $row["redacted_because"] ?? null, + transactionId: $row["transaction_id"] ?? null, + ); + return new ClientEvent( content: json_decode($row["content"], true), eventId: $row["id"], @@ -26,7 +36,7 @@ class RoomEvent roomId: $row["room_id"], sender: $row["sender"], type: EventType::from($row["type"]), - unsigned: json_decode($row["unsigned"], true), + unsigned: $unsigned, ); } diff --git a/src/Models/User.php b/src/Models/User.php index c92f5b3..b8aad62 100644 --- a/src/Models/User.php +++ b/src/Models/User.php @@ -4,9 +4,9 @@ namespace App\Models; use App\Database; use App\Errors\AppException; -use App\Errors\ErrorCode; use App\Errors\UnauthorizedError; use App\Support\ConnectsToDatabase; +use Matrix\Enums\ErrorCode; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -- cgit v1.2.3