[Room] revert creator user
Took 12 minutes
This commit is contained in:
parent
0823473bdf
commit
84900f2c30
|
@ -87,9 +87,6 @@ class Room {
|
||||||
|
|
||||||
Event lastEvent;
|
Event lastEvent;
|
||||||
|
|
||||||
// The user who created the room based on m.create events
|
|
||||||
User creator;
|
|
||||||
|
|
||||||
/// Your current client instance.
|
/// Your current client instance.
|
||||||
final Client client;
|
final Client client;
|
||||||
|
|
||||||
|
@ -122,7 +119,6 @@ class Room {
|
||||||
this.joinRules,
|
this.joinRules,
|
||||||
this.powerLevels,
|
this.powerLevels,
|
||||||
this.lastEvent,
|
this.lastEvent,
|
||||||
this.creator,
|
|
||||||
this.client,
|
this.client,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -370,13 +366,6 @@ class Room {
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Load the creator event of this room
|
|
||||||
Future<Event> getCreatorEvent(Client matrix) async {
|
|
||||||
List<Event> events = await this.loadEvents();
|
|
||||||
return events.firstWhere((event) => event.type == EventTypes.RoomCreate,
|
|
||||||
orElse: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns a Room from a json String which comes normally from the store.
|
/// Returns a Room from a json String which comes normally from the store.
|
||||||
static Future<Room> getRoomFromTableRow(
|
static Future<Room> getRoomFromTableRow(
|
||||||
Map<String, dynamic> row, Client matrix) async {
|
Map<String, dynamic> row, Client matrix) async {
|
||||||
|
@ -388,7 +377,7 @@ class Room {
|
||||||
if (avatarUrl == "")
|
if (avatarUrl == "")
|
||||||
avatarUrl = await matrix.store?.getAvatarFromSingleChat(row["id"]) ?? "";
|
avatarUrl = await matrix.store?.getAvatarFromSingleChat(row["id"]) ?? "";
|
||||||
|
|
||||||
Room room = Room(
|
return Room(
|
||||||
id: row["id"],
|
id: row["id"],
|
||||||
name: name,
|
name: name,
|
||||||
membership: row["membership"],
|
membership: row["membership"],
|
||||||
|
@ -423,17 +412,6 @@ class Room {
|
||||||
lastEvent: Event.fromJson(row, null),
|
lastEvent: Event.fromJson(row, null),
|
||||||
client: matrix,
|
client: matrix,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Lets get the creator too if not a test as tests cant use the stpre :(
|
|
||||||
if (matrix.homeserver != "https://fakeServer.notExisting") {
|
|
||||||
Event creatorEvent = await room.getCreatorEvent(matrix);
|
|
||||||
if (creatorEvent != null) {
|
|
||||||
room.creator = await matrix.store
|
|
||||||
?.getUser(matrixID: creatorEvent.id, room: row["id"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return room;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use client.store.getRoomById(String id) instead!")
|
@Deprecated("Use client.store.getRoomById(String id) instead!")
|
||||||
|
|
Loading…
Reference in a new issue