improve delete bot ux
This commit is contained in:
parent
302f3459a1
commit
53a8af8d20
|
@ -6,6 +6,7 @@ import { msatsToSats } from '../../lib/format'
|
|||
import { bioSchema, emailSchema, settingsSchema, ssValidate, userSchema } from '../../lib/validate'
|
||||
import { getItem, updateItem, filterClause, createItem, whereClause, muteClause } from './item'
|
||||
import { datePivot } from '../../lib/time'
|
||||
import { ANON_USER_ID, DELETE_USER_ID, RESERVED_MAX_USER_ID } from '../../lib/constants'
|
||||
|
||||
const contributors = new Set()
|
||||
|
||||
|
@ -489,7 +490,10 @@ export default {
|
|||
},
|
||||
searchUsers: async (parent, { q, limit, similarity }, { models }) => {
|
||||
return await models.$queryRaw`
|
||||
SELECT * FROM users where id > 615 AND SIMILARITY(name, ${q}) > ${Number(similarity) || 0.1} ORDER BY SIMILARITY(name, ${q}) DESC LIMIT ${Number(limit) || 5}`
|
||||
SELECT *
|
||||
FROM users
|
||||
WHERE (id > ${RESERVED_MAX_USER_ID} OR id IN (${ANON_USER_ID}, ${DELETE_USER_ID}))
|
||||
AND SIMILARITY(name, ${q}) > ${Number(similarity) || 0.1} ORDER BY SIMILARITY(name, ${q}) DESC LIMIT ${Number(limit) || 5}`
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -46,12 +46,14 @@ export const ITEM_TYPES = context => {
|
|||
}
|
||||
export const OLD_ITEM_DAYS = 3
|
||||
export const ANON_USER_ID = 27
|
||||
export const DELETE_USER_ID = 106
|
||||
export const AD_USER_ID = 9
|
||||
export const ANON_POST_FEE = 1000
|
||||
export const ANON_COMMENT_FEE = 100
|
||||
export const SSR = typeof window === 'undefined'
|
||||
export const MAX_FORWARDS = 5
|
||||
export const LNURLP_COMMENT_MAX_LENGTH = 1000
|
||||
export const RESERVED_MAX_USER_ID = 615
|
||||
export const GLOBAL_SEED = 616
|
||||
|
||||
export const FOUND_BLURBS = [
|
||||
|
|
|
@ -12,7 +12,8 @@ export const defaultCommentSort = (pinned, bio, createdAt) => {
|
|||
|
||||
export const isJob = item => typeof item.maxBid !== 'undefined'
|
||||
|
||||
const deletePattern = /\B@delete\s+in\s+(\d+)\s+(second|minute|hour|day|week|month|year)s?/gi
|
||||
// a delete directive preceded by a non word character that isn't a backtick
|
||||
const deletePattern = /\B(?<!`)@delete\s+in\s+(\d+)\s+(second|minute|hour|day|week|month|year)s?/gi
|
||||
|
||||
export const getDeleteCommand = (text) => {
|
||||
if (!text) return false
|
||||
|
|
Loading…
Reference in New Issue