[Event] Set default status to '2' if there is no status given.

This commit is contained in:
Christian Pauly 2019-06-26 17:27:27 +02:00
parent e652e79a98
commit 7423ab6d2b
2 changed files with 2 additions and 4 deletions

View File

@ -142,7 +142,7 @@ class Event {
ChatTime(jsonObj["origin_server_ts"]),
stateKey: User(jsonObj["state_key"]),
environment: jsonObj["type"],
status: jsonObj["status"],
status: jsonObj["status"] ?? 2,
content: content,
room: room,
);

View File

@ -35,7 +35,6 @@ void main() {
final String empty = "";
final String membership = "join";
final String type = "m.room.message";
final int status = 2;
final String msgtype = "m.text";
final String body = "Hello World";
final String formatted_body = "<b>Hello</b> World";
@ -52,7 +51,6 @@ void main() {
"origin_server_ts": timestamp,
"state_key": empty,
"type": type,
"status": status,
"content_json": contentJson,
};
@ -63,7 +61,7 @@ void main() {
expect(event.sender.displayName, senderDisplayname);
expect(event.sender.avatarUrl.mxc, empty);
expect(event.sender.membership, membership);
expect(event.status, status);
expect(event.status, 2);
expect(event.text, body);
expect(event.formattedText, formatted_body);
expect(event.getBody(), body);