Merge pull request #5890 from vector-im/feature/bma/another_cleanup

This is not necessary to map the EventId
This commit is contained in:
Benoit Marty 2022-05-04 10:47:05 +02:00 committed by GitHub
commit 2ff6604555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2 additions and 7 deletions

1
changelog.d/5890.sdk Normal file
View File

@ -0,0 +1 @@
Remove unecessary field `eventId` from `EventAnnotationsSummary` and `ReferencesAggregatedSummary`

View File

@ -16,7 +16,6 @@
package org.matrix.android.sdk.api.session.room.model package org.matrix.android.sdk.api.session.room.model
data class EventAnnotationsSummary( data class EventAnnotationsSummary(
val eventId: String,
val reactionsSummary: List<ReactionAggregatedSummary> = emptyList(), val reactionsSummary: List<ReactionAggregatedSummary> = emptyList(),
val editSummary: EditAggregatedSummary? = null, val editSummary: EditAggregatedSummary? = null,
val pollResponseSummary: PollResponseAggregatedSummary? = null, val pollResponseSummary: PollResponseAggregatedSummary? = null,

View File

@ -22,7 +22,6 @@ import org.matrix.android.sdk.api.session.events.model.Content
* of all events that are referencing the 'eventId' event via the RelationType.REFERENCE * of all events that are referencing the 'eventId' event via the RelationType.REFERENCE
*/ */
data class ReferencesAggregatedSummary( data class ReferencesAggregatedSummary(
val eventId: String,
val content: Content?, val content: Content?,
val sourceEvents: List<String>, val sourceEvents: List<String>,
val localEchos: List<String> val localEchos: List<String>

View File

@ -25,7 +25,6 @@ import org.matrix.android.sdk.internal.database.model.EventAnnotationsSummaryEnt
internal object EventAnnotationsSummaryMapper { internal object EventAnnotationsSummaryMapper {
fun map(annotationsSummary: EventAnnotationsSummaryEntity): EventAnnotationsSummary { fun map(annotationsSummary: EventAnnotationsSummaryEntity): EventAnnotationsSummary {
return EventAnnotationsSummary( return EventAnnotationsSummary(
eventId = annotationsSummary.eventId,
reactionsSummary = annotationsSummary.reactionsSummary.toList().map { reactionsSummary = annotationsSummary.reactionsSummary.toList().map {
ReactionAggregatedSummary( ReactionAggregatedSummary(
it.key, it.key,
@ -50,7 +49,6 @@ internal object EventAnnotationsSummaryMapper {
}, },
referencesAggregatedSummary = annotationsSummary.referencesSummaryEntity?.let { referencesAggregatedSummary = annotationsSummary.referencesSummaryEntity?.let {
ReferencesAggregatedSummary( ReferencesAggregatedSummary(
it.eventId,
ContentMapper.map(it.content), ContentMapper.map(it.content),
it.sourceEvents.toList(), it.sourceEvents.toList(),
it.sourceLocalEcho.toList() it.sourceLocalEcho.toList()

View File

@ -98,9 +98,7 @@ internal class UIEchoManager(private val listener: Listener) {
val relatedEventID = timelineEvent.eventId val relatedEventID = timelineEvent.eventId
val contents = inMemoryReactions[relatedEventID] ?: return timelineEvent val contents = inMemoryReactions[relatedEventID] ?: return timelineEvent
var existingAnnotationSummary = timelineEvent.annotations ?: EventAnnotationsSummary( var existingAnnotationSummary = timelineEvent.annotations ?: EventAnnotationsSummary()
relatedEventID
)
val updateReactions = existingAnnotationSummary.reactionsSummary.toMutableList() val updateReactions = existingAnnotationSummary.reactionsSummary.toMutableList()
contents.forEach { uiEchoReaction -> contents.forEach { uiEchoReaction ->