Limits Notification downloads to 1 week.
This commit is contained in:
@@ -6,6 +6,7 @@ import com.vitorpamplona.amethyst.model.User
|
|||||||
import com.vitorpamplona.amethyst.service.relays.COMMON_FEED_TYPES
|
import com.vitorpamplona.amethyst.service.relays.COMMON_FEED_TYPES
|
||||||
import com.vitorpamplona.amethyst.service.relays.Client
|
import com.vitorpamplona.amethyst.service.relays.Client
|
||||||
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
||||||
|
import com.vitorpamplona.amethyst.service.relays.EOSETime
|
||||||
import com.vitorpamplona.amethyst.service.relays.JsonFilter
|
import com.vitorpamplona.amethyst.service.relays.JsonFilter
|
||||||
import com.vitorpamplona.amethyst.service.relays.Relay
|
import com.vitorpamplona.amethyst.service.relays.Relay
|
||||||
import com.vitorpamplona.amethyst.service.relays.TypedFilter
|
import com.vitorpamplona.amethyst.service.relays.TypedFilter
|
||||||
@@ -32,6 +33,7 @@ import com.vitorpamplona.quartz.events.RepostEvent
|
|||||||
import com.vitorpamplona.quartz.events.SealedGossipEvent
|
import com.vitorpamplona.quartz.events.SealedGossipEvent
|
||||||
import com.vitorpamplona.quartz.events.StatusEvent
|
import com.vitorpamplona.quartz.events.StatusEvent
|
||||||
import com.vitorpamplona.quartz.events.TextNoteEvent
|
import com.vitorpamplona.quartz.events.TextNoteEvent
|
||||||
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
|
|
||||||
// TODO: Migrate this to a property of AccountVi
|
// TODO: Migrate this to a property of AccountVi
|
||||||
object NostrAccountDataSource : NostrDataSource("AccountData") {
|
object NostrAccountDataSource : NostrDataSource("AccountData") {
|
||||||
@@ -116,26 +118,32 @@ object NostrAccountDataSource : NostrDataSource("AccountData") {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createNotificationFilter() = TypedFilter(
|
fun createNotificationFilter(): TypedFilter {
|
||||||
types = COMMON_FEED_TYPES,
|
val since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultNotificationFollowList.value)?.relayList
|
||||||
filter = JsonFilter(
|
?: account.activeRelays()?.associate { it.url to EOSETime(TimeUtils.oneWeekAgo()) }
|
||||||
kinds = listOf(
|
?: account.convertLocalRelays().associate { it.url to EOSETime(TimeUtils.oneWeekAgo()) }
|
||||||
TextNoteEvent.kind,
|
|
||||||
PollNoteEvent.kind,
|
return TypedFilter(
|
||||||
ReactionEvent.kind,
|
types = COMMON_FEED_TYPES,
|
||||||
RepostEvent.kind,
|
filter = JsonFilter(
|
||||||
GenericRepostEvent.kind,
|
kinds = listOf(
|
||||||
ReportEvent.kind,
|
TextNoteEvent.kind,
|
||||||
LnZapEvent.kind,
|
PollNoteEvent.kind,
|
||||||
LnZapPaymentResponseEvent.kind,
|
ReactionEvent.kind,
|
||||||
ChannelMessageEvent.kind,
|
RepostEvent.kind,
|
||||||
BadgeAwardEvent.kind
|
GenericRepostEvent.kind,
|
||||||
),
|
ReportEvent.kind,
|
||||||
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
LnZapEvent.kind,
|
||||||
limit = 4000,
|
LnZapPaymentResponseEvent.kind,
|
||||||
since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultNotificationFollowList.value)?.relayList
|
ChannelMessageEvent.kind,
|
||||||
|
BadgeAwardEvent.kind
|
||||||
|
),
|
||||||
|
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
||||||
|
limit = 4000,
|
||||||
|
since = since
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
fun createGiftWrapsToMeFilter() = TypedFilter(
|
fun createGiftWrapsToMeFilter() = TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
|
|||||||
Reference in New Issue
Block a user