Compare commits

..

No commits in common. "0d93c92e30d0a7b9bede5666bd5f65ed2c87b92f" and "d8c604172a544c84790f5fc7786876bc466fb4aa" have entirely different histories.

7 changed files with 16 additions and 39 deletions

View File

@ -20,15 +20,18 @@ export async function getBaseCost ({ models, bio, parentId, subName }) {
if (parentId) {
// the subname is stored in the root item of the thread
const [sub] = await models.$queryRaw`
SELECT s."replyCost"
FROM "Item" i
LEFT JOIN "Item" r ON r.id = i."rootId"
LEFT JOIN "Sub" s ON s.name = COALESCE(r."subName", i."subName")
WHERE i.id = ${Number(parentId)}`
const parent = await models.item.findFirst({
where: { id: Number(parentId) },
include: {
root: { include: { sub: true } },
sub: true
}
})
if (sub?.replyCost) return satsToMsats(sub.replyCost)
return DEFAULT_ITEM_COST
const root = parent.root ?? parent
if (!root.sub) return DEFAULT_ITEM_COST
return satsToMsats(root.sub.replyCost)
}
const sub = await models.sub.findUnique({ where: { name: subName } })

View File

@ -51,7 +51,7 @@ export const AccountProvider = ({ children }) => {
}, [])
const multiAuthSignout = useCallback(async () => {
const { status } = await fetch('/api/next-account', { credentials: 'include' })
const { status } = await fetch('/api/signout', { credentials: 'include' })
// if status is 302, this means the server was able to switch us to the next available account
// and the current account was simply removed from the list of available accounts including the corresponding JWT.
const switchSuccess = status === 302

View File

@ -8,7 +8,7 @@ sub: meta
_To quickly browse through this FAQ page, click the chapters icon in the top-right corner. This will let you scroll through all chapters or search for a particular topic within this page._
last updated: March 12, 2025
last updated: February 7, 2025
---
@ -174,26 +174,6 @@ This can happen for any of the following reasons:
You cannot disable receiving CCs but we might change that in the future. For now, you can donate any CCs you received [here](/rewards).
### If I attach a wallet, do I always pay with sats?
No. We will only try to pay with sats from your wallet when you zap other stackers. In any other case, you're paying us, Stacker News, and we will thus try to first use any CCs you already have. If you don't have enough CCs, we will fallback to your attached wallet.
### Can I pay only the remainder with sats?
No. Payments can currently only be made entirely in CCs or sats.
### Which wallet is used if I attached multiple wallets for send or receive?
All of them! The wallet that is the furthest to the top-right will be attempted first. If it fails, we will attempt the next wallet in order. On desktop, you can drag the wallets around to rearrange their priority. On mobile, you need to click on a wallet and then select where you want the wallet to be.
These sender and receiver fallbacks happen if the payment failed for any reason. The sender will attempt the next wallet if the error was caused by the sender side and the same is true for the receiver.
The only limitation is that we will currently not attempt to pay with CCs at the end once we started to try paying with sats but all wallets failed. This will change in the future.
### Are payments retried in the background?
Yes. We try each payment three times in total with all sender and receiver fallbacks. If a payment still wasn't successful after that, you will receive a notification allowing you to retry the payment manually.
---
## Territories
@ -269,7 +249,7 @@ The info text mentions that you will inherit all existing content.
Other than that, the process to bring back an archived territory is the same as founding a new territory.
### Can I share the costs and revenue of a territory with someone?
### I want to share the costs and revenue of a territory with someone. How do I do that?
You can't do that yet but this is planned. Currently, territories can only have a single founder.

View File

@ -108,7 +108,6 @@ export const ITEM_FULL_FIELDS = gql`
moderated
meMuteSub
meSubscription
replyCost
}
}
forwards {

View File

@ -1,5 +1,5 @@
import * as cookie from 'cookie'
import { datePivot } from '@/lib/time'
import { datePivot } from '../../lib/time'
/**
* @param {NextApiRequest} req

View File

@ -1,2 +0,0 @@
-- Add constraint to ensure replyCost is positive
ALTER TABLE "Sub" ADD CONSTRAINT "Sub_replyCost_positive" CHECK ("replyCost" > 0);

View File

@ -236,7 +236,6 @@ function RetryHandler ({ children }) {
const waitForWalletPayment = useWalletPayment()
const invoiceHelper = useInvoice()
const [getFailedInvoices] = useLazyQuery(FAILED_INVOICES, { fetchPolicy: 'network-only', nextFetchPolicy: 'network-only' })
const { me } = useMe()
const retry = useCallback(async (invoice) => {
const newInvoice = await invoiceHelper.retry({ ...invoice, newAttempt: true })
@ -256,8 +255,6 @@ function RetryHandler ({ children }) {
// we always retry failed invoices, even if the user has no wallets on any client
// to make sure that failed payments will always show up in notifications eventually
if (!me) return
const retryPoll = async () => {
let failedInvoices
try {
@ -301,7 +298,7 @@ function RetryHandler ({ children }) {
queuePoll()
return stopPolling
}, [me?.id, wallets, getFailedInvoices, retry])
}, [wallets, getFailedInvoices, retry])
return children
}