Fix anon users can't zap other anon users

This commit is contained in:
ekzyis 2023-08-10 22:57:45 +02:00
parent 081c5fef0b
commit 35760e1655
1 changed files with 9 additions and 7 deletions

View File

@ -764,7 +764,8 @@ export default {
user = invoice.user
}
// disallow self tips
// disallow self tips except anons
if (user.id !== ANON_USER_ID) {
const [item] = await models.$queryRawUnsafe(`
${SELECT}
FROM "Item"
@ -772,6 +773,7 @@ export default {
if (item) {
throw new GraphQLError('cannot zap your self', { extensions: { code: 'BAD_INPUT' } })
}
}
const calls = [
models.$queryRaw`SELECT item_act(${Number(id)}::INTEGER, ${user.id}::INTEGER, 'TIP', ${Number(sats)}::INTEGER)`