Merge branch 'soru/test-web' into 'master'

test web

See merge request famedly/famedlysdk!396
This commit is contained in:
Marcel 2020-07-24 13:51:35 +00:00
commit 772cb2cf1d
2 changed files with 10 additions and 13 deletions

View file

@ -41,10 +41,9 @@ class MatrixEvent extends StrippedStateEvent {
unsigned = json['unsigned'] != null unsigned = json['unsigned'] != null
? Map<String, dynamic>.from(json['unsigned']) ? Map<String, dynamic>.from(json['unsigned'])
: null; : null;
prevContent = prevContent = json['prev_content'] != null
json.containsKey('prev_content') && json['prev_content'] != null ? Map<String, dynamic>.from(json['prev_content'])
? Map<String, dynamic>.from(json['prev_content']) : null;
: null;
redacts = json['redacts']; redacts = json['redacts'];
} }

View file

@ -93,9 +93,7 @@ class Event extends MatrixEvent {
// into the unsigned block // into the unsigned block
this.prevContent = prevContent != null && prevContent.isNotEmpty this.prevContent = prevContent != null && prevContent.isNotEmpty
? prevContent ? prevContent
: (unsigned != null && : (unsigned != null && unsigned['prev_content'] is Map
unsigned.containsKey('prev_content') &&
unsigned['prev_content'] is Map
? unsigned['prev_content'] ? unsigned['prev_content']
: null); : null);
this.stateKey = stateKey; this.stateKey = stateKey;
@ -483,10 +481,10 @@ class Event extends MatrixEvent {
final targetName = stateKeyUser.calcDisplayname(); final targetName = stateKeyUser.calcDisplayname();
// Has the membership changed? // Has the membership changed?
final newMembership = content['membership'] ?? ''; final newMembership = content['membership'] ?? '';
final oldMembership = unsigned.containsKey('prev_content') && final oldMembership =
unsigned['prev_content'] is Map<String, dynamic> unsigned != null && unsigned['prev_content'] is Map<String, dynamic>
? unsigned['prev_content']['membership'] ?? '' ? unsigned['prev_content']['membership'] ?? ''
: ''; : '';
if (newMembership != oldMembership) { if (newMembership != oldMembership) {
if (oldMembership == 'invite' && newMembership == 'join') { if (oldMembership == 'invite' && newMembership == 'join') {
text = i18n.acceptedTheInvitation(targetName); text = i18n.acceptedTheInvitation(targetName);
@ -521,13 +519,13 @@ class Event extends MatrixEvent {
} }
} else if (newMembership == 'join') { } else if (newMembership == 'join') {
final newAvatar = content['avatar_url'] ?? ''; final newAvatar = content['avatar_url'] ?? '';
final oldAvatar = unsigned.containsKey('prev_content') && final oldAvatar = unsigned != null &&
unsigned['prev_content'] is Map<String, dynamic> unsigned['prev_content'] is Map<String, dynamic>
? unsigned['prev_content']['avatar_url'] ?? '' ? unsigned['prev_content']['avatar_url'] ?? ''
: ''; : '';
final newDisplayname = content['displayname'] ?? ''; final newDisplayname = content['displayname'] ?? '';
final oldDisplayname = unsigned.containsKey('prev_content') && final oldDisplayname = unsigned != null &&
unsigned['prev_content'] is Map<String, dynamic> unsigned['prev_content'] is Map<String, dynamic>
? unsigned['prev_content']['displayname'] ?? '' ? unsigned['prev_content']['displayname'] ?? ''
: ''; : '';