Merge pull request #1962 from vector-im/feature/membership_state_event

A Kick appears has "someone has made no change" (Fixes #1959)
This commit is contained in:
Benoit Marty 2020-08-20 18:29:23 +02:00 committed by GitHub
commit 2acda2c5da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -22,6 +22,7 @@ Bugfix 🐛:
- Fix crash reported by RageShake - Fix crash reported by RageShake
- Fix refreshing of sessions list when another session is logged out - Fix refreshing of sessions list when another session is logged out
- Failed to build unique file (#1954) - Failed to build unique file (#1954)
- A Kick appears has "someone has made no change" (#1959)
Translations 🗣: Translations 🗣:
- Add PlayStore description resources in the Triple-T format, to let Weblate handle them - Add PlayStore description resources in the Triple-T format, to let Weblate handle them

View File

@ -327,6 +327,7 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
val eventContent: RoomMemberContent? = event.getClearContent().toModel() val eventContent: RoomMemberContent? = event.getClearContent().toModel()
val prevEventContent: RoomMemberContent? = event.resolvedPrevContent().toModel() val prevEventContent: RoomMemberContent? = event.resolvedPrevContent().toModel()
val isMembershipEvent = prevEventContent?.membership != eventContent?.membership val isMembershipEvent = prevEventContent?.membership != eventContent?.membership
|| eventContent?.membership == Membership.LEAVE
return if (isMembershipEvent) { return if (isMembershipEvent) {
buildMembershipNotice(event, senderName, eventContent, prevEventContent) buildMembershipNotice(event, senderName, eventContent, prevEventContent)
} else { } else {
@ -569,6 +570,7 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
sp.getString(R.string.notice_room_withdraw_with_reason, senderDisplayName, targetDisplayName, reason) sp.getString(R.string.notice_room_withdraw_with_reason, senderDisplayName, targetDisplayName, reason)
} ?: sp.getString(R.string.notice_room_withdraw, senderDisplayName, targetDisplayName) } ?: sp.getString(R.string.notice_room_withdraw, senderDisplayName, targetDisplayName)
} }
Membership.LEAVE,
Membership.JOIN -> Membership.JOIN ->
if (event.isSentByCurrentUser()) { if (event.isSentByCurrentUser()) {
eventContent.safeReason?.let { reason -> eventContent.safeReason?.let { reason ->