stacker.news/fragments/comments.js
ekzyis 52365c32ed
Wallet badges (#2040)
* Remove gun+horse streak

* Add wallet badges

* Fix empty recv wallet detected as enabled

* Resolve badges via columns and triggers

* Fix backwards compatibility by not dropping GQL fields

* Gun+horse notifications as streaks via triggers

* Fix error while computing streaks

* Push notifications for horse+gun

* Move logic to JS via pgboss job

* Fix argument to notifyNewStreak

* Update checkWallet comment

* Refactor notification id hack

* Formatting

* Fix missing update of possibleTypes

This didn't cause any bugs because the added types have no field resolvers.

* Add user migration

* Fix missing cast to date

* Run checkWallet queries inside transaction
2025-04-09 15:29:44 -05:00

119 lines
1.9 KiB
JavaScript

import { gql } from '@apollo/client'
// we can't import from users because of circular dependency
const STREAK_FIELDS = gql`
fragment StreakFields on User {
optional {
streak
hasSendWallet
hasRecvWallet
}
}
`
export const COMMENT_FIELDS = gql`
${STREAK_FIELDS}
fragment CommentFields on Item {
id
position
parentId
createdAt
invoicePaidAt
deletedAt
text
user {
id
name
meMute
...StreakFields
}
sats
credits
meAnonSats @client
upvotes
freedFreebie
boost
meSats
meCredits
meDontLikeSats
meBookmark
meSubscription
outlawed
freebie
path
commentSats
commentCredits
mine
otsHash
ncomments
nDirectComments
imgproxyUrls
rel
apiKey
invoice {
id
actionState
confirmedAt
}
cost
}
`
export const COMMENTS_ITEM_EXT_FIELDS = gql`
${STREAK_FIELDS}
fragment CommentItemExtFields on Item {
text
root {
id
title
bounty
ncomments
bountyPaidTo
subName
sub {
name
userId
moderated
meMuteSub
}
user {
name
id
...StreakFields
}
}
}`
// we only get the first COMMENT_DEPTH_LIMIT comments
export const COMMENTS = gql`
${COMMENT_FIELDS}
fragment CommentsRecursive on Item {
...CommentFields
comments {
comments {
...CommentFields
comments {
comments {
...CommentFields
comments {
comments {
...CommentFields
comments {
comments {
...CommentFields
comments {
comments {
...CommentFields
}
}
}
}
}
}
}
}
}
}
}`