Merge branch 'Event-fix-default-status' into 'master'

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

See merge request famedly/famedlysdk!16
This commit is contained in:
Marcel 2019-06-26 16:35:54 +00:00
commit 7e753d4d0b
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);