Hide "X made no changes" event by default in timeline (#1430)
This commit is contained in:
parent
1b95d98ccd
commit
3f1e5b9b1e
@ -6,6 +6,7 @@ Features ✨:
|
||||
|
||||
Improvements 🙌:
|
||||
- New wording for notice when current user is the sender
|
||||
- Hide "X made no changes" event by default in timeline (#1430)
|
||||
|
||||
Bugfix 🐛:
|
||||
- Switch theme is not fully taken into account without restarting the app
|
||||
|
@ -32,6 +32,10 @@ data class TimelineSettings(
|
||||
* A flag to filter redacted events
|
||||
*/
|
||||
val filterRedacted: Boolean = false,
|
||||
/**
|
||||
* A flag to filter useless events, such as membership events without any change
|
||||
*/
|
||||
val filterUseless: Boolean = false,
|
||||
/**
|
||||
* A flag to filter by types. It should be used with [allowedTypes] field
|
||||
*/
|
||||
@ -44,5 +48,4 @@ data class TimelineSettings(
|
||||
* If true, will build read receipts for each event.
|
||||
*/
|
||||
val buildReadReceipts: Boolean = true
|
||||
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ package im.vector.matrix.android.internal.database.mapper
|
||||
import com.squareup.moshi.JsonDataException
|
||||
import im.vector.matrix.android.api.session.crypto.MXCryptoError
|
||||
import im.vector.matrix.android.api.session.events.model.Event
|
||||
import im.vector.matrix.android.api.session.events.model.EventType
|
||||
import im.vector.matrix.android.api.session.events.model.UnsignedData
|
||||
import im.vector.matrix.android.api.session.room.send.SendState
|
||||
import im.vector.matrix.android.internal.crypto.algorithms.olm.OlmDecryptionResult
|
||||
@ -38,6 +39,7 @@ internal object EventMapper {
|
||||
eventEntity.content = ContentMapper.map(event.content)
|
||||
val resolvedPrevContent = event.prevContent ?: event.unsignedData?.prevContent
|
||||
eventEntity.prevContent = ContentMapper.map(resolvedPrevContent)
|
||||
eventEntity.isUseless = event.type == EventType.STATE_ROOM_MEMBER && eventEntity.content == eventEntity.prevContent
|
||||
eventEntity.stateKey = event.stateKey
|
||||
eventEntity.type = event.type
|
||||
eventEntity.sender = event.senderId
|
||||
|
@ -28,6 +28,7 @@ internal open class EventEntity(@Index var eventId: String = "",
|
||||
@Index var type: String = "",
|
||||
var content: String? = null,
|
||||
var prevContent: String? = null,
|
||||
var isUseless: Boolean = false,
|
||||
@Index var stateKey: String? = null,
|
||||
var originServerTs: Long? = null,
|
||||
@Index var sender: String? = null,
|
||||
|
@ -775,6 +775,9 @@ internal class DefaultTimeline(
|
||||
if (settings.filterTypes) {
|
||||
`in`(TimelineEventEntityFields.ROOT.TYPE, settings.allowedTypes.toTypedArray())
|
||||
}
|
||||
if (settings.filterUseless) {
|
||||
not().equalTo(TimelineEventEntityFields.ROOT.IS_USELESS, true)
|
||||
}
|
||||
if (settings.filterEdits) {
|
||||
not().like(TimelineEventEntityFields.ROOT.CONTENT, TimelineEventFilter.Content.EDIT)
|
||||
not().like(TimelineEventEntityFields.ROOT.CONTENT, TimelineEventFilter.Content.RESPONSE)
|
||||
|
@ -154,6 +154,11 @@ internal class TimelineHiddenReadReceipts constructor(private val readReceiptsSu
|
||||
not().`in`("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.TYPE}", settings.allowedTypes.toTypedArray())
|
||||
needOr = true
|
||||
}
|
||||
if (settings.filterUseless) {
|
||||
if (needOr) or()
|
||||
equalTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.IS_USELESS}", true)
|
||||
needOr = true
|
||||
}
|
||||
if (settings.filterEdits) {
|
||||
if (needOr) or()
|
||||
like("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.CONTENT}", TimelineEventFilter.Content.EDIT)
|
||||
|
@ -100,12 +100,14 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||
TimelineSettings(30,
|
||||
filterEdits = false,
|
||||
filterRedacted = userPreferencesProvider.shouldShowRedactedMessages().not(),
|
||||
filterUseless = false,
|
||||
filterTypes = false,
|
||||
buildReadReceipts = userPreferencesProvider.shouldShowReadReceipts())
|
||||
} else {
|
||||
TimelineSettings(30,
|
||||
filterEdits = true,
|
||||
filterRedacted = userPreferencesProvider.shouldShowRedactedMessages().not(),
|
||||
filterUseless = true,
|
||||
filterTypes = true,
|
||||
allowedTypes = TimelineDisplayableEvents.DISPLAYABLE_TYPES,
|
||||
buildReadReceipts = userPreferencesProvider.shouldShowReadReceipts())
|
||||
|
Loading…
x
Reference in New Issue
Block a user