Skip to content

Commit 3947ff8

Browse files
authored
Merge branch 'master' into custom_domain
2 parents f959c7f + 0d93c92 commit 3947ff8

File tree

8 files changed

+52
-29
lines changed

8 files changed

+52
-29
lines changed

api/paidAction/itemCreate.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ export async function getBaseCost ({ models, bio, parentId, subName }) {
2020

2121
if (parentId) {
2222
// the subname is stored in the root item of the thread
23-
const parent = await models.item.findFirst({
24-
where: { id: Number(parentId) },
25-
include: {
26-
root: { include: { sub: true } },
27-
sub: true
28-
}
29-
})
30-
31-
const root = parent.root ?? parent
32-
33-
if (!root.sub) return DEFAULT_ITEM_COST
34-
return satsToMsats(root.sub.replyCost)
23+
const [sub] = await models.$queryRaw`
24+
SELECT s."replyCost"
25+
FROM "Item" i
26+
LEFT JOIN "Item" r ON r.id = i."rootId"
27+
LEFT JOIN "Sub" s ON s.name = COALESCE(r."subName", i."subName")
28+
WHERE i.id = ${Number(parentId)}`
29+
30+
if (sub?.replyCost) return satsToMsats(sub.replyCost)
31+
return DEFAULT_ITEM_COST
3532
}
3633

3734
const sub = await models.sub.findUnique({ where: { name: subName } })

awards.csv

+12-12
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,17 @@ SatsAllDay,issue,#1820,#1819,easy,,,1,9k,[email protected],2025-01-27
175175
Soxasora,pr,#1814,#1736,easy,,,,100k,[email protected],2025-01-27
176176
jason-me,pr,#1857,,easy,,,,100k,[email protected],2025-02-08
177177
ed-kung,pr,#1901,#323,good-first-issue,,,,20k,[email protected],2025-02-14
178-
Scroogey-SN,pr,#1911,#1905,good-first-issue,,,1,18k,[email protected],???
179-
Scroogey-SN,pr,#1928,#1924,good-first-issue,,,,20k,[email protected],???
178+
Scroogey-SN,pr,#1911,#1905,good-first-issue,,,1,18k,[email protected],2025-03-10
179+
Scroogey-SN,pr,#1928,#1924,good-first-issue,,,,20k,[email protected],2025-03-10
180180
dtonon,issue,#1928,#1924,good-first-issue,,,,2k,???,???
181-
ed-kung,pr,#1926,#1914,medium-hard,,,,500k,[email protected],???
182-
ed-kung,issue,#1926,#1914,medium-hard,,,,50k,[email protected],???
183-
ed-kung,pr,#1926,#1927,easy,,,,100k,[email protected],???
184-
ed-kung,issue,#1926,#1927,easy,,,,10k,[email protected],???
185-
ed-kung,issue,#1913,#1890,good-first-issue,,,,2k,[email protected],???
186-
Scroogey-SN,pr,#1930,#1167,good-first-issue,,,,20k,[email protected],???
181+
ed-kung,pr,#1926,#1914,medium-hard,,,,500k,[email protected],2025-03-10
182+
ed-kung,issue,#1926,#1914,medium-hard,,,,50k,[email protected],2025-03-10
183+
ed-kung,pr,#1926,#1927,easy,,,,100k,[email protected],2025-03-10
184+
ed-kung,issue,#1926,#1927,easy,,,,10k,[email protected],2025-03-10
185+
ed-kung,issue,#1913,#1890,good-first-issue,,,,2k,[email protected],2025-03-10
186+
Scroogey-SN,pr,#1930,#1167,good-first-issue,,,,20k,[email protected],2025-03-10
187187
itsrealfake,issue,#1930,#1167,good-first-issue,,,,2k,[email protected],???
188-
Scroogey-SN,pr,#1948,#1849,medium,urgent,,,750k,[email protected],???
189-
felipebueno,issue,#1947,#1945,good-first-issue,,,,2k,[email protected],???
190-
ed-kung,pr,#1952,#1951,easy,,,,100k,[email protected],???
191-
ed-kung,issue,#1952,#1951,easy,,,,10k,[email protected],???
188+
Scroogey-SN,pr,#1948,#1849,medium,urgent,,,750k,[email protected],2025-03-10
189+
felipebueno,issue,#1947,#1945,good-first-issue,,,,2k,[email protected],2025-03-10
190+
ed-kung,pr,#1952,#1951,easy,,,,100k,[email protected],2025-03-10
191+
ed-kung,issue,#1952,#1951,easy,,,,10k,[email protected],2025-03-10

components/account.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const AccountProvider = ({ children }) => {
5151
}, [])
5252

5353
const multiAuthSignout = useCallback(async () => {
54-
const { status } = await fetch('/api/signout', { credentials: 'include' })
54+
const { status } = await fetch('/api/next-account', { credentials: 'include' })
5555
// if status is 302, this means the server was able to switch us to the next available account
5656
// and the current account was simply removed from the list of available accounts including the corresponding JWT.
5757
const switchSuccess = status === 302

docs/user/faq.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sub: meta
88

99
_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._
1010

11-
last updated: February 7, 2025
11+
last updated: March 12, 2025
1212

1313
---
1414

@@ -174,6 +174,26 @@ This can happen for any of the following reasons:
174174

175175
You cannot disable receiving CCs but we might change that in the future. For now, you can donate any CCs you received [here](/rewards).
176176

177+
### If I attach a wallet, do I always pay with sats?
178+
179+
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.
180+
181+
### Can I pay only the remainder with sats?
182+
183+
No. Payments can currently only be made entirely in CCs or sats.
184+
185+
### Which wallet is used if I attached multiple wallets for send or receive?
186+
187+
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.
188+
189+
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.
190+
191+
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.
192+
193+
### Are payments retried in the background?
194+
195+
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.
196+
177197
---
178198

179199
## Territories
@@ -249,7 +269,7 @@ The info text mentions that you will inherit all existing content.
249269

250270
Other than that, the process to bring back an archived territory is the same as founding a new territory.
251271

252-
### I want to share the costs and revenue of a territory with someone. How do I do that?
272+
### Can I share the costs and revenue of a territory with someone?
253273

254274
You can't do that yet but this is planned. Currently, territories can only have a single founder.
255275

fragments/items.js

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export const ITEM_FULL_FIELDS = gql`
108108
moderated
109109
meMuteSub
110110
meSubscription
111+
replyCost
111112
}
112113
}
113114
forwards {

pages/api/signout.js pages/api/next-account.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as cookie from 'cookie'
2-
import { datePivot } from '../../lib/time'
2+
import { datePivot } from '@/lib/time'
33

44
/**
55
* @param {NextApiRequest} req
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Add constraint to ensure replyCost is positive
2+
ALTER TABLE "Sub" ADD CONSTRAINT "Sub_replyCost_positive" CHECK ("replyCost" > 0);

wallets/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ function RetryHandler ({ children }) {
236236
const waitForWalletPayment = useWalletPayment()
237237
const invoiceHelper = useInvoice()
238238
const [getFailedInvoices] = useLazyQuery(FAILED_INVOICES, { fetchPolicy: 'network-only', nextFetchPolicy: 'network-only' })
239+
const { me } = useMe()
239240

240241
const retry = useCallback(async (invoice) => {
241242
const newInvoice = await invoiceHelper.retry({ ...invoice, newAttempt: true })
@@ -255,6 +256,8 @@ function RetryHandler ({ children }) {
255256
// we always retry failed invoices, even if the user has no wallets on any client
256257
// to make sure that failed payments will always show up in notifications eventually
257258

259+
if (!me) return
260+
258261
const retryPoll = async () => {
259262
let failedInvoices
260263
try {
@@ -298,7 +301,7 @@ function RetryHandler ({ children }) {
298301

299302
queuePoll()
300303
return stopPolling
301-
}, [wallets, getFailedInvoices, retry])
304+
}, [me?.id, wallets, getFailedInvoices, retry])
302305

303306
return children
304307
}

0 commit comments

Comments
 (0)