stacker.news/worker/ephemeralItems.js
SatsAllDay 1d394bebe1
Ephemeral item support (#570)
backend impl and some of the UI for ephemeral item support

more to come, this is just a WIP so far

Consolidate client-side ephemeral fee logic in FeeButton components for easier reuse

* update the update_item function to handle the case where an item was not
ephemeral, but now is, so we charge the user accordingly

* introduce `hasDeleteCommand` for a better logical abstraction for some use cases in the code

* introduce `EPHEMERAL_FEE_SATS` which is derived from `EPHEMERAL_FEE_MSATS`, so we don't
have to the same calculation over and over

Remove fees for ephemeral items

* remove unused markdownField prop in FeeButton

* remove empty migration

minor code cleanup

Centralize delete item by author code to reduce duplication
2023-10-22 11:02:58 -05:00

14 lines
352 B
JavaScript

import { deleteItemByAuthor } from '../lib/item.js'
export function deleteItem ({ models }) {
return async function ({ data: eventData }) {
console.log('deleteItem', eventData)
const { id } = eventData
try {
await deleteItemByAuthor({ models, id })
} catch (err) {
console.error('failed to delete item', err)
}
}
}