use builtin copy input label

This commit is contained in:
keyan 2023-08-11 18:43:45 -05:00
parent 705e21a72c
commit 5b821906cf
2 changed files with 12 additions and 6 deletions

View File

@ -672,7 +672,8 @@ export default {
return item return item
} else { } else {
const [query] = await serialize(models, const [query] = await serialize(models,
models.$queryRawUnsafe(`${SELECT} FROM create_poll($1, $2, $3, $4::INTEGER, $5::INTEGER, $6::INTEGER, $7, $8::INTEGER, '${spamInterval}') AS "Item"`, models.$queryRawUnsafe(
`${SELECT} FROM create_poll($1, $2, $3, $4::INTEGER, $5::INTEGER, $6::INTEGER, $7, $8::INTEGER, '${spamInterval}') AS "Item"`,
sub || 'bitcoin', title, text, 1, Number(boost || 0), Number(author.id), options, Number(fwdUser?.id)), ...trx) sub || 'bitcoin', title, text, 1, Number(boost || 0), Number(author.id), options, Number(fwdUser?.id)), ...trx)
const item = trx.length > 0 ? query[0] : query const item = trx.length > 0 ? query[0] : query
@ -718,7 +719,8 @@ export default {
}, },
createComment: async (parent, data, { me, models }) => { createComment: async (parent, data, { me, models }) => {
await ssValidate(commentSchema, data) await ssValidate(commentSchema, data)
const item = await createItem(parent, data, { me, models, invoiceHash: data.invoiceHash, invoiceHmac: data.invoiceHmac }) const item = await createItem(parent, data,
{ me, models, invoiceHash: data.invoiceHash, invoiceHmac: data.invoiceHmac })
// fetch user to get up-to-date name // fetch user to get up-to-date name
const user = await models.user.findUnique({ where: { id: me?.id || ANON_USER_ID } }) const user = await models.user.findUnique({ where: { id: me?.id || ANON_USER_ID } })
@ -787,7 +789,8 @@ export default {
const [{ item_act: vote }] = await serialize(models, ...calls) const [{ item_act: vote }] = await serialize(models, ...calls)
const updatedItem = await models.item.findUnique({ where: { id: Number(id) } }) const updatedItem = await models.item.findUnique({ where: { id: Number(id) } })
const title = `your ${updatedItem.title ? 'post' : 'reply'} ${updatedItem.fwdUser ? 'forwarded' : 'stacked'} ${numWithUnits(msatsToSats(updatedItem.msats))}${updatedItem.fwdUser ? ` to @${updatedItem.fwdUser.name}` : ''}` const title = `your ${updatedItem.title ? 'post' : 'reply'} ${updatedItem.fwdUser ? 'forwarded' : 'stacked'} ${
numWithUnits(msatsToSats(updatedItem.msats))}${updatedItem.fwdUser ? ` to @${updatedItem.fwdUser.name}` : ''}`
sendUserNotification(updatedItem.userId, { sendUserNotification(updatedItem.userId, {
title, title,
body: updatedItem.title ? updatedItem.title : updatedItem.text, body: updatedItem.title ? updatedItem.title : updatedItem.text,
@ -815,7 +818,8 @@ export default {
throw new GraphQLError('cannot downvote your self', { extensions: { code: 'BAD_INPUT' } }) throw new GraphQLError('cannot downvote your self', { extensions: { code: 'BAD_INPUT' } })
} }
await serialize(models, models.$queryRaw`SELECT item_act(${Number(id)}::INTEGER, ${me.id}::INTEGER, 'DONT_LIKE_THIS', ${DONT_LIKE_THIS_COST}::INTEGER)`) await serialize(models, models.$queryRaw`SELECT item_act(${Number(id)}::INTEGER,
${me.id}::INTEGER, 'DONT_LIKE_THIS', ${DONT_LIKE_THIS_COST}::INTEGER)`)
return true return true
} }

View File

@ -69,9 +69,11 @@ const Contacts = ({ invoiceHash, invoiceHmac }) => {
const body = 'Hi, I successfully paid for <insert action> but the action did not work.' const body = 'Hi, I successfully paid for <insert action> but the action did not work.'
return ( return (
<div className='d-flex flex-column justify-content-center mt-2'> <div className='d-flex flex-column justify-content-center mt-2'>
<div className='pb-2 fw-bold'>payment token</div>
<div className='w-100'> <div className='w-100'>
<CopyInput type='text' placeholder={invoiceHash + '|' + invoiceHmac} readOnly noForm /> <CopyInput
label={<>payment token <small className='text-danger fw-normal ms-2'>save this</small></>}
type='text' placeholder={invoiceHash + '|' + invoiceHmac} readOnly noForm
/>
</div> </div>
<div className='d-flex flex-row justify-content-center'> <div className='d-flex flex-row justify-content-center'>
<a <a