mzivil 6355d7eabc
Add nsfw setting to territories (#788)
* 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>
2024-02-09 20:35:32 -06:00

41 lines
999 B
JavaScript

import { gql } from 'graphql-tag'
export default gql`
extend type Query {
sub(name: String): Sub
subLatestPost(name: String!): String
subs: [Sub!]!
}
extend type Mutation {
upsertSub(oldName: String, name: String!, desc: String, baseCost: Int!,
postTypes: [String!]!, allowFreebies: Boolean!,
billingType: String!, billingAutoRenew: Boolean!,
moderated: Boolean!, hash: String, hmac: String, nsfw: Boolean!): Sub
paySub(name: String!, hash: String, hmac: String): Sub
toggleMuteSub(name: String!): Boolean!
}
type Sub {
name: ID!
createdAt: Date!
userId: Int!
user: User!
desc: String
updatedAt: Date!
postTypes: [String!]!
allowFreebies: Boolean!
billingCost: Int!
billingType: String!
billingAutoRenew: Boolean!
rankingType: String!
billedLastAt: Date!
baseCost: Int!
status: String!
moderated: Boolean!
moderatedCount: Int!
meMuteSub: Boolean!
nsfw: Boolean!
}
`