diff --git a/api/typeDefs/item.js b/api/typeDefs/item.js index 12fa7141..fc3b5ab4 100644 --- a/api/typeDefs/item.js +++ b/api/typeDefs/item.js @@ -118,6 +118,7 @@ export default gql` location: String remote: Boolean sub: Sub + subName: String status: String uploadId: Int otsHash: String diff --git a/components/bounty-form.js b/components/bounty-form.js index ae3d62c4..f43a8616 100644 --- a/components/bounty-form.js +++ b/components/bounty-form.js @@ -62,7 +62,7 @@ export function BountyForm ({ (async ({ boost, bounty, ...values }) => { const { error } = await upsertBounty({ variables: { - sub: item?.sub?.name || sub?.name, + sub: item?.subName || sub?.name, id: item?.id, boost: boost ? Number(boost) : undefined, bounty: bounty ? Number(bounty) : undefined, diff --git a/components/comment.js b/components/comment.js index b58719aa..bb21390a 100644 --- a/components/comment.js +++ b/components/comment.js @@ -41,9 +41,9 @@ function Parent ({ item, rootText }) { {rootText || 'on:'} {item.root.title} - {item.root.sub?.name && - - {' '}{item.root.sub?.name} + {item.root.subName && + + {' '}{item.root.subName} } ) diff --git a/components/discussion-form.js b/components/discussion-form.js index 02e2ebcf..20a6f45d 100644 --- a/components/discussion-form.js +++ b/components/discussion-form.js @@ -56,7 +56,7 @@ export function DiscussionForm ({ schema={schema} onSubmit={handleSubmit || (async ({ boost, ...values }) => { const { error } = await upsertDiscussion({ - variables: { sub: item?.sub?.name || sub?.name, id: item?.id, boost: boost ? Number(boost) : undefined, ...values } + variables: { sub: item?.subName || sub?.name, id: item?.id, boost: boost ? Number(boost) : undefined, ...values } }) if (error) { throw new Error({ message: error.toString() }) diff --git a/components/item-info.js b/components/item-info.js index 287bcfb8..ab7220ed 100644 --- a/components/item-info.js +++ b/components/item-info.js @@ -65,9 +65,9 @@ export default function ItemInfo ({ item, commentsText, className, embellishUser } - {item.sub?.name && - - {' '}{item.sub?.name} + {item.subName && + + {' '}{item.subName} } {(item.outlawed && !item.mine && diff --git a/components/link-form.js b/components/link-form.js index 19542e62..5dbeef5c 100644 --- a/components/link-form.js +++ b/components/link-form.js @@ -85,7 +85,7 @@ export function LinkForm ({ item, sub, editThreshold }) { schema={schema} onSubmit={async ({ boost, title, ...values }) => { const { error } = await upsertLink({ - variables: { sub: item?.sub?.name || sub?.name, id: item?.id, boost: boost ? Number(boost) : undefined, title: title.trim(), ...values } + variables: { sub: item?.subName || sub?.name, id: item?.id, boost: boost ? Number(boost) : undefined, title: title.trim(), ...values } }) if (error) { throw new Error({ message: error.toString() }) diff --git a/components/poll-form.js b/components/poll-form.js index 0c9b3e58..928e1723 100644 --- a/components/poll-form.js +++ b/components/poll-form.js @@ -42,7 +42,7 @@ export function PollForm ({ item, sub, editThreshold }) { const { error } = await upsertPoll({ variables: { id: item?.id, - sub: item?.sub?.name || sub?.name, + sub: item?.subName || sub?.name, boost: boost ? Number(boost) : undefined, title: title.trim(), options: optionsFiltered, diff --git a/fragments/comments.js b/fragments/comments.js index 32943638..a0c54c7b 100644 --- a/fragments/comments.js +++ b/fragments/comments.js @@ -31,9 +31,7 @@ export const COMMENT_FIELDS = gql` title bounty bountyPaidTo - sub { - name - } + subName user { name streak diff --git a/fragments/items.js b/fragments/items.js index 915d8824..71c5e180 100644 --- a/fragments/items.js +++ b/fragments/items.js @@ -37,10 +37,7 @@ export const ITEM_FIELDS = gql` company location remote - sub { - name - baseCost - } + subName pollCost status uploadId @@ -63,9 +60,7 @@ export const ITEM_FULL_FIELDS = gql` title bounty bountyPaidTo - sub { - name - } + subName user { name streak diff --git a/pages/items/[id]/edit.js b/pages/items/[id]/edit.js index 45f9f9b5..8f717fa3 100644 --- a/pages/items/[id]/edit.js +++ b/pages/items/[id]/edit.js @@ -14,7 +14,7 @@ export default function PostEdit ({ data: { item } }) { const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000 return ( - + {item.isJob ? : (item.url diff --git a/pages/items/[id]/index.js b/pages/items/[id]/index.js index 7b758f58..bf7acf0c 100644 --- a/pages/items/[id]/index.js +++ b/pages/items/[id]/index.js @@ -16,7 +16,7 @@ export default function AnItem ({ data: { item } }) { ({ item } = data) } - const sub = item.sub?.name || item.root?.sub?.name + const sub = item.subName || item.root?.subName return (