fix: Properly detect sicket message types
This commit is contained in:
parent
5863c8e168
commit
54a128d2c5
|
@ -229,7 +229,9 @@ class Event extends MatrixEvent {
|
|||
unsigned: unsigned,
|
||||
room: room);
|
||||
|
||||
String get messageType => content['msgtype'] ?? MessageTypes.Text;
|
||||
String get messageType => type == EventTypes.Sticker
|
||||
? MessageTypes.Sticker
|
||||
: content['msgtype'] ?? MessageTypes.Text;
|
||||
|
||||
void setRedactionEvent(Event redactedBecause) {
|
||||
unsigned = {
|
||||
|
|
|
@ -167,6 +167,11 @@ void main() {
|
|||
event = Event.fromJson(jsonObj, null);
|
||||
expect(event.messageType, MessageTypes.Location);
|
||||
|
||||
jsonObj['type'] = 'm.sticker';
|
||||
jsonObj['content']['msgtype'] = null;
|
||||
event = Event.fromJson(jsonObj, null);
|
||||
expect(event.messageType, MessageTypes.Sticker);
|
||||
|
||||
jsonObj['type'] = 'm.room.message';
|
||||
jsonObj['content']['msgtype'] = 'm.text';
|
||||
jsonObj['content']['m.relates_to'] = {};
|
||||
|
|
Loading…
Reference in a new issue