stacker.news/fragments/comments.js
ekzyis ca7726fda5
Fix recent sort order for retried items (#1829)
* Fix recent sort order for retried items

* Also fix for comments

* don't hide createdAt, order item query inner subquery

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-01-22 17:42:18 -06:00

113 lines
1.8 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
gunStreak
horseStreak
}
}
`
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
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
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 {
...CommentFields
comments {
...CommentFields
comments {
...CommentFields
comments {
...CommentFields
comments {
...CommentFields
comments {
...CommentFields
comments {
...CommentFields
}
}
}
}
}
}
}
}`