Do not show edition from other users

This commit is contained in:
Benoit Marty 2021-03-02 11:11:28 +01:00
parent f5fad8a082
commit c33af6de6a
2 changed files with 9 additions and 3 deletions

View file

@ -92,6 +92,9 @@ interface RelationService {
/**
* Get the edit history of the given event
* The return list will contain the original event and all the editions of this event, done by the
* same sender, sorted in the reverse order (so the original event is the latest element, and the
* latest edition is the first element of the list)
*/
suspend fun fetchEditHistory(eventId: String): List<Event>

View file

@ -49,8 +49,11 @@ internal class DefaultFetchEditHistoryTask @Inject constructor(
)
}
val events = response.chunks.toMutableList()
response.originalEvent?.let { events.add(it) }
return events
// Filter out edition form other users
val originalSenderId = response.originalEvent?.senderId
val events = response.chunks.filter {
it.senderId == originalSenderId
}
return events + listOfNotNull(response.originalEvent)
}
}