stacker.news/fragments/notifications.js
SatsAllDay 94fbabcdf9
Notifications for when you are forwarded sats from a post (#467)
* Notifications for when you are forwarded sats from a post

Support notifications when a post for which you are forwarded gets zapped

This is controlled by a new boolean flag in user settings

* Send push notifications to forwarded users when they get forwarded sats

* Add `Promise.allSettled` per PR feedback

* Remove `FEE` act type when building forwarded zaps notifications

Don't include `FEE` actions, only `TIP` actions to avoid "0 sats forwarded" notifications

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-12 10:31:46 -05:00

107 lines
2.0 KiB
JavaScript

import { gql } from '@apollo/client'
import { ITEM_FULL_FIELDS } from './items'
import { INVITE_FIELDS } from './invites'
export const HAS_NOTIFICATIONS = gql`{ hasNewNotes }`
export const NOTIFICATIONS = gql`
${ITEM_FULL_FIELDS}
${INVITE_FIELDS}
query Notifications($cursor: String, $inc: String) {
notifications(cursor: $cursor, inc: $inc) {
cursor
lastChecked
notifications {
__typename
... on Mention {
id
sortTime
mention
item {
...ItemFullFields
text
}
}
... on Votification {
id
sortTime
earnedSats
item {
...ItemFullFields
text
}
}
... on ForwardedVotification {
id
sortTime
earnedSats
item {
...ItemFullFields
text
}
}
... on Streak {
id
sortTime
days
}
... on Earn {
id
sortTime
minSortTime
earnedSats
sources {
posts
comments
tipPosts
tipComments
}
}
... on Referral {
id
sortTime
}
... on Reply {
id
sortTime
item {
...ItemFullFields
text
}
}
... on FollowActivity {
id
sortTime
item {
...ItemFullFields
text
}
}
... on Invitification {
id
sortTime
invite {
...InviteFields
}
}
... on JobChanged {
id
sortTime
item {
...ItemFields
}
}
... on InvoicePaid {
id
sortTime
earnedSats
invoice {
id
nostr
}
}
}
}
} `