Fix missing handling of redacted beacon location data events

This commit is contained in:
Maxime NATUREL 2022-07-12 16:58:02 +02:00
parent 8fb402ab10
commit 1277376496
4 changed files with 14 additions and 3 deletions

View File

@ -75,6 +75,7 @@ internal class RedactionEventProcessor @Inject constructor() : EventInsertLivePr
EventType.ENCRYPTED, EventType.ENCRYPTED,
EventType.MESSAGE, EventType.MESSAGE,
in EventType.STATE_ROOM_BEACON_INFO, in EventType.STATE_ROOM_BEACON_INFO,
in EventType.BEACON_LOCATION_DATA,
in EventType.POLL_START -> { in EventType.POLL_START -> {
Timber.d("REDACTION for message ${eventToPrune.eventId}") Timber.d("REDACTION for message ${eventToPrune.eventId}")
val unsignedData = EventMapper.map(eventToPrune).unsignedData val unsignedData = EventMapper.map(eventToPrune).unsignedData

View File

@ -113,8 +113,14 @@ class TimelineItemFactory @Inject constructor(
EventType.CALL_NEGOTIATE, EventType.CALL_NEGOTIATE,
EventType.REACTION, EventType.REACTION,
in EventType.POLL_RESPONSE, in EventType.POLL_RESPONSE,
in EventType.POLL_END, in EventType.POLL_END -> noticeItemFactory.create(params)
in EventType.BEACON_LOCATION_DATA -> noticeItemFactory.create(params) in EventType.BEACON_LOCATION_DATA -> {
if (event.root.isRedacted()) {
messageItemFactory.create(params)
} else {
noticeItemFactory.create(params)
}
}
// Calls // Calls
EventType.CALL_INVITE, EventType.CALL_INVITE,
EventType.CALL_HANGUP, EventType.CALL_HANGUP,

View File

@ -51,7 +51,7 @@ object TimelineDisplayableEvents {
EventType.STATE_ROOM_JOIN_RULES, EventType.STATE_ROOM_JOIN_RULES,
EventType.KEY_VERIFICATION_DONE, EventType.KEY_VERIFICATION_DONE,
EventType.KEY_VERIFICATION_CANCEL, EventType.KEY_VERIFICATION_CANCEL,
) + EventType.POLL_START + EventType.STATE_ROOM_BEACON_INFO ) + EventType.POLL_START + EventType.STATE_ROOM_BEACON_INFO + EventType.BEACON_LOCATION_DATA
} }
fun TimelineEvent.isRoomConfiguration(roomCreatorUserId: String?): Boolean { fun TimelineEvent.isRoomConfiguration(roomCreatorUserId: String?): Boolean {

View File

@ -241,6 +241,10 @@ class TimelineEventVisibilityHelper @Inject constructor(
} else root.eventId != rootThreadEventId } else root.eventId != rootThreadEventId
} }
if (root.getClearType() in EventType.BEACON_LOCATION_DATA) {
return !root.isRedacted()
}
return false return false
} }