6355d7eabc
* add nsfw column to sub * add nsfw boolean to territorySchema * save nsfw value in upsertSub mutation * return nsfw value from Sub query for correct value in edit territory form * add nsfw checkbox to territory form * add nsfw badge to territory header * add nsfwMode to user * show nsfw badge next to item territory * exclude nsfw sub from items query * show nsfw mode checkbox on settings page * fix nsfw badge formatting * separate user from current, signed in user * update relationClause to join with sub table * refactor to simplify hide nsfw sql * filter nsfw items when viewing user items * hide nsfw posts for logged out users * filter nsfw subs based on user preference * show nsfw sub name if logged out user is viewing the page * show current sub at the top of the list instead of bottom * always join item with sub to check nsfw * check for sub presence before showing nsfw badge on item * skip manually adding sub to select if sub is null * fix relationClause to join with root item * move moderation and nsfw into accordion --------- Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
181 lines
2.7 KiB
JavaScript
181 lines
2.7 KiB
JavaScript
import { gql } from '@apollo/client'
|
|
import { COMMENTS } from './comments'
|
|
|
|
export const ITEM_FIELDS = gql`
|
|
fragment ItemFields on Item {
|
|
id
|
|
parentId
|
|
createdAt
|
|
deletedAt
|
|
title
|
|
url
|
|
user {
|
|
id
|
|
name
|
|
optional {
|
|
streak
|
|
}
|
|
meMute
|
|
}
|
|
sub {
|
|
name
|
|
userId
|
|
moderated
|
|
meMuteSub
|
|
nsfw
|
|
}
|
|
otsHash
|
|
position
|
|
sats
|
|
meAnonSats @client
|
|
boost
|
|
bounty
|
|
bountyPaidTo
|
|
noteId
|
|
path
|
|
upvotes
|
|
meSats
|
|
meDontLikeSats
|
|
meBookmark
|
|
meSubscription
|
|
meForward
|
|
outlawed
|
|
freebie
|
|
bio
|
|
ncomments
|
|
commentSats
|
|
lastCommentAt
|
|
maxBid
|
|
isJob
|
|
company
|
|
location
|
|
remote
|
|
subName
|
|
pollCost
|
|
status
|
|
uploadId
|
|
mine
|
|
imgproxyUrls
|
|
}`
|
|
|
|
export const ITEM_FULL_FIELDS = gql`
|
|
${ITEM_FIELDS}
|
|
fragment ItemFullFields on Item {
|
|
...ItemFields
|
|
text
|
|
root {
|
|
id
|
|
title
|
|
bounty
|
|
bountyPaidTo
|
|
subName
|
|
user {
|
|
id
|
|
name
|
|
optional {
|
|
streak
|
|
}
|
|
}
|
|
sub {
|
|
name
|
|
userId
|
|
moderated
|
|
meMuteSub
|
|
}
|
|
}
|
|
forwards {
|
|
userId
|
|
pct
|
|
user {
|
|
name
|
|
}
|
|
}
|
|
}`
|
|
|
|
export const ITEM_OTS_FIELDS = gql`
|
|
fragment ItemOtsFields on Item {
|
|
id
|
|
title
|
|
text
|
|
url
|
|
parentOtsHash
|
|
otsHash
|
|
deletedAt
|
|
}`
|
|
|
|
export const ITEM_OTS = gql`
|
|
${ITEM_OTS_FIELDS}
|
|
|
|
query Item($id: ID!) {
|
|
item(id: $id) {
|
|
...ItemOtsFields
|
|
}
|
|
}`
|
|
|
|
export const POLL_FIELDS = gql`
|
|
fragment PollFields on Item {
|
|
poll {
|
|
meVoted
|
|
count
|
|
options {
|
|
id
|
|
option
|
|
count
|
|
meVoted
|
|
}
|
|
}
|
|
}`
|
|
|
|
export const ITEM = gql`
|
|
${ITEM_FULL_FIELDS}
|
|
${POLL_FIELDS}
|
|
|
|
query Item($id: ID!) {
|
|
item(id: $id) {
|
|
...ItemFullFields
|
|
...PollFields
|
|
}
|
|
}`
|
|
|
|
export const ITEM_FULL = gql`
|
|
${ITEM_FULL_FIELDS}
|
|
${POLL_FIELDS}
|
|
${COMMENTS}
|
|
query Item($id: ID!, $sort: String) {
|
|
item(id: $id) {
|
|
...ItemFullFields
|
|
prior
|
|
...PollFields
|
|
comments(sort: $sort) {
|
|
...CommentsRecursive
|
|
}
|
|
}
|
|
}`
|
|
|
|
export const RELATED_ITEMS = gql`
|
|
${ITEM_FIELDS}
|
|
query Related($title: String, $id: ID, $cursor: String, $limit: Limit) {
|
|
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
|
|
cursor
|
|
items {
|
|
...ItemFields
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const RELATED_ITEMS_WITH_ITEM = gql`
|
|
${ITEM_FIELDS}
|
|
query Related($title: String, $id: ID!, $cursor: String, $limit: Limit) {
|
|
item(id: $id) {
|
|
...ItemFields
|
|
}
|
|
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
|
|
cursor
|
|
items {
|
|
...ItemFields
|
|
}
|
|
}
|
|
}
|
|
`
|