summaryrefslogtreecommitdiff
path: root/src/Models/RoomEvent.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Models/RoomEvent.php')
-rw-r--r--src/Models/RoomEvent.php12
1 files changed, 11 insertions, 1 deletions
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,
);
}