mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-18 05:41:56 +01:00
Fixes lack of reactions on video feeds
This commit is contained in:
parent
16cf3c850a
commit
0dcce5a987
@ -22,9 +22,11 @@ package com.vitorpamplona.amethyst.ui.dal
|
||||
|
||||
import com.vitorpamplona.amethyst.commons.richtext.RichTextParser.Companion.isImageOrVideoUrl
|
||||
import com.vitorpamplona.amethyst.model.Account
|
||||
import com.vitorpamplona.amethyst.model.AddressableNote
|
||||
import com.vitorpamplona.amethyst.model.LocalCache
|
||||
import com.vitorpamplona.amethyst.model.Note
|
||||
import com.vitorpamplona.amethyst.service.SUPPORTED_VIDEO_FEED_MIME_TYPES_SET
|
||||
import com.vitorpamplona.quartz.events.AddressableEvent
|
||||
import com.vitorpamplona.quartz.events.FileHeaderEvent
|
||||
import com.vitorpamplona.quartz.events.FileStorageHeaderEvent
|
||||
import com.vitorpamplona.quartz.events.MuteListEvent
|
||||
@ -48,7 +50,10 @@ class VideoFeedFilter(
|
||||
val notes =
|
||||
LocalCache.notes.filterIntoSet { _, it ->
|
||||
acceptableEvent(it, params)
|
||||
}
|
||||
} +
|
||||
LocalCache.addressables.filterIntoSet { _, it ->
|
||||
acceptableEvent(it, params)
|
||||
}
|
||||
|
||||
return sort(notes)
|
||||
}
|
||||
@ -62,10 +67,14 @@ class VideoFeedFilter(
|
||||
}
|
||||
|
||||
fun acceptableEvent(
|
||||
it: Note,
|
||||
note: Note,
|
||||
params: FilterByListParams,
|
||||
): Boolean {
|
||||
val noteEvent = it.event
|
||||
val noteEvent = note.event
|
||||
|
||||
if (noteEvent is AddressableEvent && note !is AddressableNote) {
|
||||
return false
|
||||
}
|
||||
|
||||
return (
|
||||
(noteEvent is FileHeaderEvent && noteEvent.hasUrl() && (noteEvent.urls().any { isImageOrVideoUrl(it) } || noteEvent.isOneOf(SUPPORTED_VIDEO_FEED_MIME_TYPES_SET))) ||
|
||||
@ -75,7 +84,7 @@ class VideoFeedFilter(
|
||||
noteEvent is PictureEvent
|
||||
) &&
|
||||
params.match(noteEvent) &&
|
||||
(params.isHiddenList || account.isAcceptable(it))
|
||||
(params.isHiddenList || account.isAcceptable(note))
|
||||
}
|
||||
|
||||
fun buildFilterParams(account: Account): FilterByListParams =
|
||||
|
Loading…
x
Reference in New Issue
Block a user