Filtering Addressable notes from Notification's note stack
This commit is contained in:
+7
-3
@@ -29,6 +29,7 @@ import com.vitorpamplona.amethyst.ui.dal.DefaultFeedOrder
|
|||||||
import com.vitorpamplona.amethyst.ui.dal.FilterByListParams
|
import com.vitorpamplona.amethyst.ui.dal.FilterByListParams
|
||||||
import com.vitorpamplona.quartz.experimental.forks.forkFromVersion
|
import com.vitorpamplona.quartz.experimental.forks.forkFromVersion
|
||||||
import com.vitorpamplona.quartz.experimental.forks.isForkFromAddressWithPubkey
|
import com.vitorpamplona.quartz.experimental.forks.isForkFromAddressWithPubkey
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser
|
import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser
|
||||||
import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent
|
import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent
|
||||||
@@ -74,8 +75,11 @@ class NotificationFeedFilter(
|
|||||||
|
|
||||||
val notifications =
|
val notifications =
|
||||||
LocalCache.notes.filterIntoSet { _, note ->
|
LocalCache.notes.filterIntoSet { _, note ->
|
||||||
acceptableEvent(note, filterParams)
|
note.event !is AddressableEvent && acceptableEvent(note, filterParams)
|
||||||
}
|
} +
|
||||||
|
LocalCache.addressables.filterIntoSet { _, note ->
|
||||||
|
acceptableEvent(note, filterParams)
|
||||||
|
}
|
||||||
|
|
||||||
return sort(notifications)
|
return sort(notifications)
|
||||||
}
|
}
|
||||||
@@ -126,7 +130,7 @@ class NotificationFeedFilter(
|
|||||||
it.event !is GiftWrapEvent &&
|
it.event !is GiftWrapEvent &&
|
||||||
it.event !is PrivateTagArrayEvent &&
|
it.event !is PrivateTagArrayEvent &&
|
||||||
(it.event is LnZapEvent || notifAuthor != loggedInUserHex) &&
|
(it.event is LnZapEvent || notifAuthor != loggedInUserHex) &&
|
||||||
(filterParams.isGlobal(it.relays) || notifAuthor == null || filterParams.isAuthorInFollows(notifAuthor) == true) &&
|
(filterParams.isGlobal(it.relays) || notifAuthor == null || filterParams.isAuthorInFollows(notifAuthor)) &&
|
||||||
it.event?.isTaggedUser(loggedInUserHex) ?: false &&
|
it.event?.isTaggedUser(loggedInUserHex) ?: false &&
|
||||||
(filterParams.isHiddenList || notifAuthor == null || !account.isHidden(notifAuthor)) &&
|
(filterParams.isHiddenList || notifAuthor == null || !account.isHidden(notifAuthor)) &&
|
||||||
tagsAnEventByUser(it, loggedInUserHex)
|
tagsAnEventByUser(it, loggedInUserHex)
|
||||||
|
|||||||
+1
@@ -310,6 +310,7 @@ open class BasicRelayClient(
|
|||||||
|
|
||||||
private fun processClosed(msg: ClosedMessage) {
|
private fun processClosed(msg: ClosedMessage) {
|
||||||
Log.w(logTag, "Relay Closed Subscription ${msg.subscriptionId} ${msg.message}")
|
Log.w(logTag, "Relay Closed Subscription ${msg.subscriptionId} ${msg.message}")
|
||||||
|
stats.newNotice("Subscription closed: ${msg.subscriptionId} ${msg.message}")
|
||||||
afterEOSEPerSubscription[msg.subscriptionId] = false
|
afterEOSEPerSubscription[msg.subscriptionId] = false
|
||||||
listener.onClosed(this@BasicRelayClient, msg.subscriptionId, msg.message)
|
listener.onClosed(this@BasicRelayClient, msg.subscriptionId, msg.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user