From 508c694c3d551cddb3b15c1b0d4787dae3c00530 Mon Sep 17 00:00:00 2001 From: Rory& Date: Thu, 2 May 2024 07:20:13 +0200 Subject: HomeserverEmulator work --- .../Controllers/Rooms/RoomStateController.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Tests/LibMatrix.HomeserverEmulator/Controllers/Rooms/RoomStateController.cs') diff --git a/Tests/LibMatrix.HomeserverEmulator/Controllers/Rooms/RoomStateController.cs b/Tests/LibMatrix.HomeserverEmulator/Controllers/Rooms/RoomStateController.cs index 3896ac0..a1738c9 100644 --- a/Tests/LibMatrix.HomeserverEmulator/Controllers/Rooms/RoomStateController.cs +++ b/Tests/LibMatrix.HomeserverEmulator/Controllers/Rooms/RoomStateController.cs @@ -1,4 +1,5 @@ using System.Collections.Frozen; +using System.Text.Json.Nodes; using LibMatrix.HomeserverEmulator.Extensions; using LibMatrix.HomeserverEmulator.Services; using Microsoft.AspNetCore.Mvc; @@ -73,12 +74,12 @@ public class RoomStateController(ILogger logger, TokenServi } [HttpPut("{eventType}")] - public async Task SetState(string roomId, string eventType, [FromBody] StateEvent request) { + public async Task SetState(string roomId, string eventType, [FromBody] JsonObject? request) { return await SetState(roomId, eventType, "", request); } [HttpPut("{eventType}/{stateKey}")] - public async Task SetState(string roomId, string eventType, string stateKey, [FromBody] StateEvent request) { + public async Task SetState(string roomId, string eventType, string stateKey, [FromBody] JsonObject? request) { var token = tokenService.GetAccessTokenOrNull(HttpContext); if (token == null) throw new MatrixException() { @@ -99,7 +100,7 @@ public class RoomStateController(ILogger logger, TokenServi ErrorCode = "M_NOT_FOUND", Error = "Room not found" }; - var evt = room.SetStateInternal(request.ToStateEvent(user, room)); + var evt = room.SetStateInternal(new StateEvent() { Type = eventType, StateKey = stateKey, RawContent = request }.ToStateEvent(user, room)); evt.Type = eventType; evt.StateKey = stateKey; return new EventIdResponse() { -- cgit 1.4.1