allow comment updates when they have boost

This commit is contained in:
k00b 2024-09-19 14:06:34 -05:00
parent e323ed27c6
commit 020b4c5eea
5 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ export async function onPaid ({ invoice, actId }, { models, tx }) {
}) })
itemAct = await tx.itemAct.findFirst({ where: { invoiceId: invoice.id } }) itemAct = await tx.itemAct.findFirst({ where: { invoiceId: invoice.id } })
} else if (actId) { } else if (actId) {
itemAct = await tx.itemAct.findFirst({ where: { id: { in: actId } } }) itemAct = await tx.itemAct.findFirst({ where: { id: actId } })
} else { } else {
throw new Error('No invoice or actId') throw new Error('No invoice or actId')
} }

View File

@ -1375,7 +1375,7 @@ export const updateItem = async (parent, { sub: subName, forward, hash, hmac, ..
item = { id: Number(item.id), text: item.text, title: `@${user.name}'s bio` } item = { id: Number(item.id), text: item.text, title: `@${user.name}'s bio` }
} else if (old.parentId) { } else if (old.parentId) {
// prevent editing a comment like a post // prevent editing a comment like a post
item = { id: Number(item.id), text: item.text } item = { id: Number(item.id), text: item.text, boost: item.boost }
} else { } else {
item = { subName, ...item } item = { subName, ...item }
item.forwardUsers = await getForwardUsers(models, forward) item.forwardUsers = await getForwardUsers(models, forward)

View File

@ -57,7 +57,7 @@ export default gql`
id: ID, sub: String, title: String!, text: String, options: [String!]!, boost: Int, forward: [ItemForwardInput], pollExpiresAt: Date, id: ID, sub: String, title: String!, text: String, options: [String!]!, boost: Int, forward: [ItemForwardInput], pollExpiresAt: Date,
hash: String, hmac: String): ItemPaidAction! hash: String, hmac: String): ItemPaidAction!
updateNoteId(id: ID!, noteId: String!): Item! updateNoteId(id: ID!, noteId: String!): Item!
upsertComment(id: ID, text: String!, parentId: ID, hash: String, hmac: String): ItemPaidAction! upsertComment(id: ID, text: String!, parentId: ID, boost: Int, hash: String, hmac: String): ItemPaidAction!
act(id: ID!, sats: Int, act: String, idempotent: Boolean): ItemActPaidAction! act(id: ID!, sats: Int, act: String, idempotent: Boolean): ItemActPaidAction!
pollVote(id: ID!): PollVotePaidAction! pollVote(id: ID!): PollVotePaidAction!
toggleOutlaw(id: ID!): Item! toggleOutlaw(id: ID!): Item!

View File

@ -44,7 +44,7 @@ export default function useItemSubmit (mutation,
variables: { variables: {
id: item?.id, id: item?.id,
sub: item?.subName || sub?.name, sub: item?.subName || sub?.name,
boost: boost ? Number(boost) : undefined, boost: boost ? Number(boost) : item?.boost ? Number(item.boost) : undefined,
bounty: bounty ? Number(bounty) : undefined, bounty: bounty ? Number(bounty) : undefined,
status: status === 'STOPPED' ? 'STOPPED' : 'ACTIVE', status: status === 'STOPPED' ? 'STOPPED' : 'ACTIVE',
title: title?.trim(), title: title?.trim(),

View File

@ -218,8 +218,8 @@ export const CREATE_COMMENT = gql`
export const UPDATE_COMMENT = gql` export const UPDATE_COMMENT = gql`
${ITEM_PAID_ACTION_FIELDS} ${ITEM_PAID_ACTION_FIELDS}
${PAID_ACTION} ${PAID_ACTION}
mutation upsertComment($id: ID!, $text: String!, ${HASH_HMAC_INPUT_1}) { mutation upsertComment($id: ID!, $text: String!, $boost: Int, ${HASH_HMAC_INPUT_1}) {
upsertComment(id: $id, text: $text, ${HASH_HMAC_INPUT_2}) { upsertComment(id: $id, text: $text, boost: $boost, ${HASH_HMAC_INPUT_2}) {
...ItemPaidActionFields ...ItemPaidActionFields
...PaidActionFields ...PaidActionFields
} }