Merge commit from fork
This commit is contained in:
parent
438dc8c121
commit
500657cb93
@ -1,5 +1,5 @@
|
|||||||
import { ensureProtocol, removeTracking, stripTrailingSlash } from '@/lib/url'
|
import { ensureProtocol, removeTracking, stripTrailingSlash } from '@/lib/url'
|
||||||
import { decodeCursor, LIMIT, nextCursorEncoded } from '@/lib/cursor'
|
import { decodeCursor, nextCursorEncoded } from '@/lib/cursor'
|
||||||
import { getMetadata, metadataRuleSets } from 'page-metadata-parser'
|
import { getMetadata, metadataRuleSets } from 'page-metadata-parser'
|
||||||
import { ruleSet as publicationDateRuleSet } from '@/lib/timedate-scraper'
|
import { ruleSet as publicationDateRuleSet } from '@/lib/timedate-scraper'
|
||||||
import domino from 'domino'
|
import domino from 'domino'
|
||||||
@ -362,7 +362,7 @@ export default {
|
|||||||
|
|
||||||
return count
|
return count
|
||||||
},
|
},
|
||||||
items: async (parent, { sub, sort, type, cursor, name, when, from, to, by, limit = LIMIT }, { me, models }) => {
|
items: async (parent, { sub, sort, type, cursor, name, when, from, to, by, limit }, { me, models }) => {
|
||||||
const decodedCursor = decodeCursor(cursor)
|
const decodedCursor = decodeCursor(cursor)
|
||||||
let items, user, pins, subFull, table, ad
|
let items, user, pins, subFull, table, ad
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ function queryParts (q) {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
Query: {
|
Query: {
|
||||||
related: async (parent, { title, id, cursor, limit = LIMIT, minMatch }, { me, models, search }) => {
|
related: async (parent, { title, id, cursor, limit, minMatch }, { me, models, search }) => {
|
||||||
const decodedCursor = decodeCursor(cursor)
|
const decodedCursor = decodeCursor(cursor)
|
||||||
|
|
||||||
if (!id && (!title || title.trim().split(/\s+/).length < 1)) {
|
if (!id && (!title || title.trim().split(/\s+/).length < 1)) {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export async function getSub (parent, { name }, { models, me }) {
|
|||||||
export default {
|
export default {
|
||||||
Query: {
|
Query: {
|
||||||
sub: getSub,
|
sub: getSub,
|
||||||
subSuggestions: async (parent, { q, limit = 5 }, { models }) => {
|
subSuggestions: async (parent, { q, limit }, { models }) => {
|
||||||
let subs = []
|
let subs = []
|
||||||
subs = await models.$queryRaw`
|
subs = await models.$queryRaw`
|
||||||
SELECT name
|
SELECT name
|
||||||
@ -88,7 +88,7 @@ export default {
|
|||||||
|
|
||||||
return latest?.createdAt
|
return latest?.createdAt
|
||||||
},
|
},
|
||||||
topSubs: async (parent, { cursor, when, by, from, to, limit = LIMIT }, { models, me }) => {
|
topSubs: async (parent, { cursor, when, by, from, to, limit }, { models, me }) => {
|
||||||
const decodedCursor = decodeCursor(cursor)
|
const decodedCursor = decodeCursor(cursor)
|
||||||
const range = whenRange(when, from, to || decodeCursor.time)
|
const range = whenRange(when, from, to || decodeCursor.time)
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ export default {
|
|||||||
subs
|
subs
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
userSubs: async (_parent, { name, cursor, when, by, from, to, limit = LIMIT }, { models, me }) => {
|
userSubs: async (_parent, { name, cursor, when, by, from, to, limit }, { models, me }) => {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new GqlInputError('must supply user name')
|
throw new GqlInputError('must supply user name')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,7 @@ async function authMethods (user, args, { models, me }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function topUsers (parent, { cursor, when, by, from, to, limit = LIMIT }, { models, me }) {
|
export async function topUsers (parent, { cursor, when, by, from, to, limit }, { models, me }) {
|
||||||
const decodedCursor = decodeCursor(cursor)
|
const decodedCursor = decodeCursor(cursor)
|
||||||
const range = whenRange(when, from, to || decodeCursor.time)
|
const range = whenRange(when, from, to || decodeCursor.time)
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ export default {
|
|||||||
users
|
users
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
userSuggestions: async (parent, { q, limit = 5 }, { models }) => {
|
userSuggestions: async (parent, { q, limit }, { models }) => {
|
||||||
let users = []
|
let users = []
|
||||||
if (q) {
|
if (q) {
|
||||||
users = await models.$queryRaw`
|
users = await models.$queryRaw`
|
||||||
@ -605,7 +605,7 @@ export default {
|
|||||||
SELECT *
|
SELECT *
|
||||||
FROM users
|
FROM users
|
||||||
WHERE (id > ${RESERVED_MAX_USER_ID} OR id IN (${USER_ID.anon}, ${USER_ID.delete}))
|
WHERE (id > ${RESERVED_MAX_USER_ID} OR id IN (${USER_ID.anon}, ${USER_ID.delete}))
|
||||||
AND SIMILARITY(name, ${q}) > ${Number(similarity) || 0.1} ORDER BY SIMILARITY(name, ${q}) DESC LIMIT ${Number(limit) || 5}`
|
AND SIMILARITY(name, ${q}) > ${Number(similarity) || 0.1} ORDER BY SIMILARITY(name, ${q}) DESC LIMIT ${Number(limit)}`
|
||||||
},
|
},
|
||||||
userStatsActions: async (parent, { when, from, to }, { me, models }) => {
|
userStatsActions: async (parent, { when, from, to }, { me, models }) => {
|
||||||
const range = whenRange(when, from, to)
|
const range = whenRange(when, from, to)
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
import { gql } from 'graphql-tag'
|
import { gql } from 'graphql-tag'
|
||||||
|
import { LIMIT } from '@/lib/cursor'
|
||||||
|
|
||||||
export default gql`
|
export default gql`
|
||||||
extend type Query {
|
extend type Query {
|
||||||
items(sub: String, sort: String, type: String, cursor: String, name: String, when: String, from: String, to: String, by: String, limit: Limit): Items
|
items(sub: String, sort: String, type: String, cursor: String, name: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): Items
|
||||||
item(id: ID!): Item
|
item(id: ID!): Item
|
||||||
pageTitleAndUnshorted(url: String!): TitleUnshorted
|
pageTitleAndUnshorted(url: String!): TitleUnshorted
|
||||||
dupes(url: String!): [Item!]
|
dupes(url: String!): [Item!]
|
||||||
related(cursor: String, title: String, id: ID, minMatch: String, limit: Limit): Items
|
related(cursor: String, title: String, id: ID, minMatch: String, limit: Limit! = ${LIMIT}): Items
|
||||||
search(q: String, sub: String, cursor: String, what: String, sort: String, when: String, from: String, to: String): Items
|
search(q: String, sub: String, cursor: String, what: String, sort: String, when: String, from: String, to: String): Items
|
||||||
auctionPosition(sub: String, id: ID, boost: Int): Int!
|
auctionPosition(sub: String, id: ID, boost: Int): Int!
|
||||||
boostPosition(sub: String, id: ID, boost: Int): BoostPositions!
|
boostPosition(sub: String, id: ID, boost: Int): BoostPositions!
|
||||||
|
|||||||
@ -1,14 +1,15 @@
|
|||||||
import { gql } from 'graphql-tag'
|
import { gql } from 'graphql-tag'
|
||||||
|
import { LIMIT } from '@/lib/cursor'
|
||||||
|
|
||||||
export default gql`
|
export default gql`
|
||||||
extend type Query {
|
extend type Query {
|
||||||
sub(name: String): Sub
|
sub(name: String): Sub
|
||||||
subLatestPost(name: String!): String
|
subLatestPost(name: String!): String
|
||||||
subs: [Sub!]!
|
subs: [Sub!]!
|
||||||
topSubs(cursor: String, when: String, from: String, to: String, by: String, limit: Limit): Subs
|
topSubs(cursor: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): Subs
|
||||||
userSubs(name: String!, cursor: String, when: String, from: String, to: String, by: String, limit: Limit): Subs
|
userSubs(name: String!, cursor: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): Subs
|
||||||
mySubscribedSubs(cursor: String): Subs
|
mySubscribedSubs(cursor: String): Subs
|
||||||
subSuggestions(q: String!, limit: Limit): [Sub!]!
|
subSuggestions(q: String!, limit: Limit! = 5): [Sub!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
type Subs {
|
type Subs {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { gql } from 'graphql-tag'
|
import { gql } from 'graphql-tag'
|
||||||
|
import { LIMIT } from '@/lib/cursor'
|
||||||
|
|
||||||
export default gql`
|
export default gql`
|
||||||
extend type Query {
|
extend type Query {
|
||||||
@ -7,10 +8,10 @@ export default gql`
|
|||||||
user(id: ID, name: String): User
|
user(id: ID, name: String): User
|
||||||
users: [User!]
|
users: [User!]
|
||||||
nameAvailable(name: String!): Boolean!
|
nameAvailable(name: String!): Boolean!
|
||||||
topUsers(cursor: String, when: String, from: String, to: String, by: String, limit: Limit): UsersNullable!
|
topUsers(cursor: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): UsersNullable!
|
||||||
topCowboys(cursor: String): UsersNullable!
|
topCowboys(cursor: String): UsersNullable!
|
||||||
searchUsers(q: String!, limit: Limit, similarity: Float): [User!]!
|
searchUsers(q: String!, limit: Limit! = 5, similarity: Float): [User!]!
|
||||||
userSuggestions(q: String, limit: Limit): [User!]!
|
userSuggestions(q: String, limit: Limit! = 5): [User!]!
|
||||||
hasNewNotes: Boolean!
|
hasNewNotes: Boolean!
|
||||||
mySubscribedUsers(cursor: String): Users!
|
mySubscribedUsers(cursor: String): Users!
|
||||||
myMutedUsers(cursor: String): Users!
|
myMutedUsers(cursor: String): Users!
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user