mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
fix based on PR review
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4c4c9506ca
commit
bd4b40309d
@ -27,11 +27,11 @@ function memberEventDiff(ev) {
|
|||||||
const content = ev.getContent();
|
const content = ev.getContent();
|
||||||
const prevContent = ev.getPrevContent();
|
const prevContent = ev.getPrevContent();
|
||||||
|
|
||||||
const isJoinToJoin = content.membership === prevContent.membership && content.membership === 'join';
|
const isMembershipChanged = content.membership !== prevContent.membership;
|
||||||
|
diff.isJoin = isMembershipChanged && content.membership === 'join';
|
||||||
diff.isJoin = !isJoinToJoin && content.membership === 'join' && prevContent.membership !== 'ban';
|
diff.isPart = isMembershipChanged && content.membership === 'leave' && ev.getStateKey() === ev.getSender();
|
||||||
diff.isPart = !isJoinToJoin && content.membership === 'leave' && ev.getStateKey() === ev.getSender();
|
|
||||||
|
|
||||||
|
const isJoinToJoin = !isMembershipChanged && content.membership === 'join';
|
||||||
diff.isDisplaynameChange = isJoinToJoin && content.displayname !== prevContent.displayname;
|
diff.isDisplaynameChange = isJoinToJoin && content.displayname !== prevContent.displayname;
|
||||||
diff.isAvatarChange = isJoinToJoin && content.avatar_url !== prevContent.avatar_url;
|
diff.isAvatarChange = isJoinToJoin && content.avatar_url !== prevContent.avatar_url;
|
||||||
return diff;
|
return diff;
|
||||||
|
Loading…
Reference in New Issue
Block a user