remove dead gql
This commit is contained in:
parent
4a35c13ff3
commit
8e01568622
@ -891,8 +891,8 @@ export default {
|
|||||||
|
|
||||||
return comments(me, models, item.id, sort || defaultCommentSort(item.pinId, item.bioId, item.createdAt))
|
return comments(me, models, item.id, sort || defaultCommentSort(item.pinId, item.bioId, item.createdAt))
|
||||||
},
|
},
|
||||||
wvotes: async (item) => {
|
freedFreebie: async (item) => {
|
||||||
return item.weightedVotes - item.weightedDownVotes
|
return item.weightedVotes - item.weightedDownVotes > 0
|
||||||
},
|
},
|
||||||
meSats: async (item, args, { me, models }) => {
|
meSats: async (item, args, { me, models }) => {
|
||||||
if (!me) return 0
|
if (!me) return 0
|
||||||
|
@ -87,7 +87,6 @@ export default gql`
|
|||||||
commentSats: Int!
|
commentSats: Int!
|
||||||
lastCommentAt: Date
|
lastCommentAt: Date
|
||||||
upvotes: Int!
|
upvotes: Int!
|
||||||
wvotes: Float!
|
|
||||||
meSats: Int!
|
meSats: Int!
|
||||||
meDontLike: Boolean!
|
meDontLike: Boolean!
|
||||||
meBookmark: Boolean!
|
meBookmark: Boolean!
|
||||||
@ -95,6 +94,7 @@ export default gql`
|
|||||||
meForward: Boolean
|
meForward: Boolean
|
||||||
outlawed: Boolean!
|
outlawed: Boolean!
|
||||||
freebie: Boolean!
|
freebie: Boolean!
|
||||||
|
freedFreebie: Boolean!
|
||||||
bio: Boolean!
|
bio: Boolean!
|
||||||
paidImgLink: Boolean
|
paidImgLink: Boolean
|
||||||
ncomments: Int!
|
ncomments: Int!
|
||||||
|
@ -100,7 +100,7 @@ export default function Comment ({
|
|||||||
}) {
|
}) {
|
||||||
const [edit, setEdit] = useState()
|
const [edit, setEdit] = useState()
|
||||||
const me = useMe()
|
const me = useMe()
|
||||||
const isHiddenFreebie = !me?.privates?.wildWestMode && !me?.privates?.greeterMode && !item.mine && item.freebie && item.wvotes <= 0
|
const isHiddenFreebie = !me?.privates?.wildWestMode && !me?.privates?.greeterMode && !item.mine && item.freebie && !item.freedFreebie
|
||||||
const [collapse, setCollapse] = useState(
|
const [collapse, setCollapse] = useState(
|
||||||
isHiddenFreebie || item?.user?.meMute
|
isHiddenFreebie || item?.user?.meMute
|
||||||
? 'yep'
|
? 'yep'
|
||||||
|
@ -18,7 +18,7 @@ export const COMMENT_FIELDS = gql`
|
|||||||
sats
|
sats
|
||||||
meAnonSats @client
|
meAnonSats @client
|
||||||
upvotes
|
upvotes
|
||||||
wvotes
|
freedFreebie
|
||||||
boost
|
boost
|
||||||
meSats
|
meSats
|
||||||
meDontLike
|
meDontLike
|
||||||
|
@ -27,7 +27,6 @@ const ITEM_SEARCH_FIELDS = gql`
|
|||||||
location
|
location
|
||||||
remote
|
remote
|
||||||
upvotes
|
upvotes
|
||||||
wvotes
|
|
||||||
sats
|
sats
|
||||||
boost
|
boost
|
||||||
lastCommentAt
|
lastCommentAt
|
||||||
@ -36,7 +35,7 @@ const ITEM_SEARCH_FIELDS = gql`
|
|||||||
ncomments
|
ncomments
|
||||||
}`
|
}`
|
||||||
|
|
||||||
async function _indexItem (item) {
|
async function _indexItem (item, { models }) {
|
||||||
console.log('indexing item', item.id)
|
console.log('indexing item', item.id)
|
||||||
|
|
||||||
// HACK: modify the title for jobs so that company/location are searchable
|
// HACK: modify the title for jobs so that company/location are searchable
|
||||||
@ -55,6 +54,13 @@ async function _indexItem (item) {
|
|||||||
itemcp.text = removeMd(item.text)
|
itemcp.text = removeMd(item.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const itemdb = await models.item.findUnique({
|
||||||
|
where: { id: Number(item.id) },
|
||||||
|
select: { weightedVotes: true, weightedDownVotes: true }
|
||||||
|
})
|
||||||
|
|
||||||
|
itemcp.wvotes = itemdb.weightedVotes - itemdb.weightedDownVotes
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await search.index({
|
await search.index({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@ -75,7 +81,7 @@ async function _indexItem (item) {
|
|||||||
console.log('done indexing item', item.id)
|
console.log('done indexing item', item.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function indexItem ({ apollo }) {
|
export function indexItem ({ apollo, models }) {
|
||||||
return async function ({ data: { id } }) {
|
return async function ({ data: { id } }) {
|
||||||
console.log('indexing item, fetching ...', id)
|
console.log('indexing item, fetching ...', id)
|
||||||
// 1. grab item from database
|
// 1. grab item from database
|
||||||
@ -92,11 +98,11 @@ export function indexItem ({ apollo }) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 2. index it with external version based on updatedAt
|
// 2. index it with external version based on updatedAt
|
||||||
await _indexItem(item)
|
await _indexItem(item, { models })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function indexAllItems ({ apollo }) {
|
export function indexAllItems ({ apollo, models }) {
|
||||||
return async function () {
|
return async function () {
|
||||||
// cursor over all items in the Item table
|
// cursor over all items in the Item table
|
||||||
let items = []; let cursor = null
|
let items = []; let cursor = null
|
||||||
@ -118,7 +124,7 @@ export function indexAllItems ({ apollo }) {
|
|||||||
|
|
||||||
// for all items, index them
|
// for all items, index them
|
||||||
try {
|
try {
|
||||||
items.forEach(_indexItem)
|
items.forEach(i => _indexItem(i, { models }))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore errors
|
// ignore errors
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user