stacker.news/fragments/notifications.js

147 lines
2.7 KiB
JavaScript
Raw Normal View History

import { gql } from '@apollo/client'
2023-02-04 00:08:08 +00:00
import { ITEM_FULL_FIELDS } from './items'
2022-01-19 21:02:38 +00:00
import { INVITE_FIELDS } from './invites'
2024-01-03 02:05:49 +00:00
import { SUB_FIELDS } from './subs'
2021-08-17 18:15:24 +00:00
export const HAS_NOTIFICATIONS = gql`{ hasNewNotes }`
2021-08-17 18:15:24 +00:00
export const NOTIFICATIONS = gql`
2023-02-04 00:08:08 +00:00
${ITEM_FULL_FIELDS}
2022-01-19 21:02:38 +00:00
${INVITE_FIELDS}
2024-01-03 02:05:49 +00:00
${SUB_FIELDS}
2021-08-17 18:15:24 +00:00
2022-04-21 17:48:27 +00:00
query Notifications($cursor: String, $inc: String) {
notifications(cursor: $cursor, inc: $inc) {
2021-08-17 18:15:24 +00:00
cursor
2021-08-20 00:13:32 +00:00
lastChecked
2021-08-17 18:15:24 +00:00
notifications {
__typename
2021-08-18 23:00:54 +00:00
... on Mention {
id
2021-08-20 00:13:32 +00:00
sortTime
2021-08-18 23:00:54 +00:00
mention
item {
2023-02-04 00:08:08 +00:00
...ItemFullFields
2021-08-18 23:00:54 +00:00
text
}
}
2021-08-17 18:15:24 +00:00
... on Votification {
id
2021-08-20 00:13:32 +00:00
sortTime
2021-08-17 18:15:24 +00:00
earnedSats
item {
2023-02-04 00:08:08 +00:00
...ItemFullFields
2021-08-17 18:15:24 +00:00
text
}
}
2023-11-21 23:32:22 +00:00
... on Revenue {
id
sortTime
earnedSats
subName
}
... on ForwardedVotification {
id
sortTime
earnedSats
item {
...ItemFullFields
text
}
}
2023-02-01 14:44:35 +00:00
... on Streak {
id
sortTime
days
}
2022-07-05 20:18:59 +00:00
... on Earn {
id
2022-07-05 20:18:59 +00:00
sortTime
2023-08-30 00:13:21 +00:00
minSortTime
2022-07-05 20:18:59 +00:00
earnedSats
sources {
posts
comments
tipPosts
tipComments
}
2022-07-05 20:18:59 +00:00
}
2022-12-19 22:27:52 +00:00
... on Referral {
id
2022-12-19 22:27:52 +00:00
sortTime
}
2021-08-17 18:15:24 +00:00
... on Reply {
id
2021-08-20 00:13:32 +00:00
sortTime
2021-08-17 18:15:24 +00:00
item {
2023-02-04 00:08:08 +00:00
...ItemFullFields
2021-08-17 18:15:24 +00:00
text
}
}
... on FollowActivity {
id
sortTime
item {
...ItemFullFields
text
}
}
... on TerritoryPost {
id
sortTime
item {
...ItemFullFields
text
}
}
Territory transfers (#878) * Allow founders to transfer territories * Log territory transfers in new AuditLog table * Add territory transfer notifications * Use polymorphic AuditEvent table * Add setting for territory transfer notifications * Add push notification * Rename label from user to stacker * More space between cancel and confirm button * Remove AuditEvent table The audit table is not necessary for territory transfers and only adds complexity and unrelated discussion to this PR. Thinking about a future-proof schema for territory transfers and how/what to audit at the same time made my head spin. Some thoughts I had: 1. Maybe using polymorphism for an audit log / audit events is not a good idea Using polymorphism as is currently used in the code base (user wallets) means that every generic event must map to exactly one specialized event. Is this a good requirement/assumption? It already didn't work well for naive auditing of territory transfers since we want events to be indexable by user (no array column) so every event needs to point to a single user but a territory transfer involves multiple users. This made me wonder: Do we even need a table? Maybe the audit log for a user can be implemented using a view? This would also mean no data denormalization. 2. What to audit and how and why? Most actions are already tracked in some way by necessity: zaps, items, mutes, payments, ... In that case: what is the benefit of tracking these things individually in a separate table? Denormalize simply for convenience or performance? Why no view (see previous point)? Use case needs to be more clearly defined before speccing out a schema. * Fix territory transfer notification id conflict * Use include instead of two separate queries * Drop territory transfer setting * Remove trigger usage * Prevent transfers to yourself
2024-03-05 19:56:02 +00:00
... on TerritoryTransfer {
id
sortTime
sub {
...SubFields
}
}
2022-01-19 21:02:38 +00:00
... on Invitification {
id
2022-01-19 21:02:38 +00:00
sortTime
invite {
...InviteFields
}
}
2022-02-28 20:09:21 +00:00
... on JobChanged {
id
2022-02-28 20:09:21 +00:00
sortTime
item {
...ItemFields
}
}
2024-01-03 02:05:49 +00:00
... on SubStatus {
id
sortTime
sub {
...SubFields
}
}
2022-03-23 18:54:39 +00:00
... on InvoicePaid {
id
2022-03-23 18:54:39 +00:00
sortTime
earnedSats
invoice {
id
nostr
comment
lud18Data
2022-03-23 18:54:39 +00:00
}
}
2024-03-25 20:20:11 +00:00
... on WithdrawlPaid {
id
sortTime
earnedSats
withdrawl {
autoWithdraw
}
2024-03-25 20:20:11 +00:00
}
2021-08-17 18:15:24 +00:00
}
}
} `