Merge branch 'room-fix-correct-state-requests' into 'master'

[Room] Fix state requests

See merge request famedly/famedlysdk!50
This commit is contained in:
Marcel 2019-07-26 10:33:44 +00:00
commit cc467bd6b1

View file

@ -147,7 +147,7 @@ class Room {
Future<dynamic> setName(String newName) async { Future<dynamic> setName(String newName) async {
dynamic res = await client.connection.jsonRequest( dynamic res = await client.connection.jsonRequest(
type: HTTPType.PUT, type: HTTPType.PUT,
action: "/client/r0/rooms/${id}/send/m.room.name/${new DateTime.now()}", action: "/client/r0/rooms/${id}/state/m.room.name}",
data: {"name": newName}); data: {"name": newName});
if (res is ErrorResponse) client.connection.onError.add(res); if (res is ErrorResponse) client.connection.onError.add(res);
return res; return res;
@ -157,8 +157,7 @@ class Room {
Future<dynamic> setDescription(String newName) async { Future<dynamic> setDescription(String newName) async {
dynamic res = await client.connection.jsonRequest( dynamic res = await client.connection.jsonRequest(
type: HTTPType.PUT, type: HTTPType.PUT,
action: action: "/client/r0/rooms/${id}/state/m.room.topic}",
"/client/r0/rooms/${id}/send/m.room.topic/${new DateTime.now()}",
data: {"topic": newName}); data: {"topic": newName});
if (res is ErrorResponse) client.connection.onError.add(res); if (res is ErrorResponse) client.connection.onError.add(res);
return res; return res;
@ -285,7 +284,7 @@ class Room {
dynamic res = await client.connection.jsonRequest( dynamic res = await client.connection.jsonRequest(
type: HTTPType.PUT, type: HTTPType.PUT,
action: "/client/r0/rooms/$id/state/m.room.power_levels/", action: "/client/r0/rooms/$id/state/m.room.power_levels",
data: {"users": powerMap}); data: {"users": powerMap});
if (res is ErrorResponse) client.connection.onError.add(res); if (res is ErrorResponse) client.connection.onError.add(res);
return res; return res;