mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-10-01 17:30:50 +00:00
Fixes Notification for Follows now showing Zaps
This commit is contained in:
parent
d3f54a7082
commit
539433014e
@ -310,6 +310,19 @@ object NostrAccountDataSource : NostrDataSource("AccountData") {
|
|||||||
event.cachedGossip(account.signer) { LocalCache.justConsume(it, relay) }
|
event.cachedGossip(account.signer) { LocalCache.justConsume(it, relay) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is LnZapEvent -> {
|
||||||
|
// Avoid decrypting over and over again if the event already exist.
|
||||||
|
|
||||||
|
val note = LocalCache.getNoteIfExists(event.id)
|
||||||
|
if (note != null && relay.brief in note.relays) return
|
||||||
|
|
||||||
|
event.zapRequest?.let {
|
||||||
|
if (it.isPrivateZap()) {
|
||||||
|
it.decryptPrivateZap(account.signer) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
LocalCache.justConsume(event, relay)
|
LocalCache.justConsume(event, relay)
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,23 @@ class NotificationFeedFilter(val account: Account) : AdditiveFeedFilter<Note>()
|
|||||||
filterParams: FilterByListParams,
|
filterParams: FilterByListParams,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val loggedInUserHex = account.userProfile().pubkeyHex
|
val loggedInUserHex = account.userProfile().pubkeyHex
|
||||||
val loggedInUser = account.userProfile()
|
|
||||||
|
val noteEvent = it.event
|
||||||
|
val notifAuthor =
|
||||||
|
if (noteEvent is LnZapEvent) {
|
||||||
|
val zapRequest = noteEvent.zapRequest
|
||||||
|
if (zapRequest != null) {
|
||||||
|
if (noteEvent.zapRequest?.isPrivateZap() == true) {
|
||||||
|
zapRequest.cachedPrivateZap()?.pubKey ?: zapRequest.pubKey
|
||||||
|
} else {
|
||||||
|
zapRequest.pubKey
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
noteEvent.pubKey
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it.author?.pubkeyHex
|
||||||
|
}
|
||||||
|
|
||||||
return it.event !is ChannelCreateEvent &&
|
return it.event !is ChannelCreateEvent &&
|
||||||
it.event !is ChannelMetadataEvent &&
|
it.event !is ChannelMetadataEvent &&
|
||||||
@ -96,10 +112,10 @@ class NotificationFeedFilter(val account: Account) : AdditiveFeedFilter<Note>()
|
|||||||
it.event !is BadgeDefinitionEvent &&
|
it.event !is BadgeDefinitionEvent &&
|
||||||
it.event !is BadgeProfilesEvent &&
|
it.event !is BadgeProfilesEvent &&
|
||||||
it.event !is GiftWrapEvent &&
|
it.event !is GiftWrapEvent &&
|
||||||
(it.event is LnZapEvent || it.author !== loggedInUser) &&
|
(it.event is LnZapEvent || notifAuthor != loggedInUserHex) &&
|
||||||
(filterParams.isGlobal || filterParams.followLists?.users?.contains(it.author?.pubkeyHex) == true) &&
|
(filterParams.isGlobal || filterParams.followLists?.users?.contains(notifAuthor) == true) &&
|
||||||
it.event?.isTaggedUser(loggedInUserHex) ?: false &&
|
it.event?.isTaggedUser(loggedInUserHex) ?: false &&
|
||||||
(filterParams.isHiddenList || it.author == null || !account.isHidden(it.author!!.pubkeyHex)) &&
|
(filterParams.isHiddenList || notifAuthor == null || !account.isHidden(notifAuthor)) &&
|
||||||
tagsAnEventByUser(it, loggedInUserHex)
|
tagsAnEventByUser(it, loggedInUserHex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user