861 Commits

Author SHA1 Message Date
Edward Kung
73170ba8a2
Territory analytics (#1926)
* add territory to analytics selectors

* implement territory analytics, revert user satistics header

* fix linting errors

* disallow some territory names

* fix linting error

* minor adjustments to header

* escape input

* 404 on non-existant sub

* exclude unused queries depending on sub select

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-02-28 19:15:18 -06:00
ekzyis
5e85147578
Fix receiver fallback on caller error (#1907)
* Rename to createUserInvoice

* Fix no receiver fallback on wrap, direct or autowithdrawal error

* Fix missing error logs for direct payments
2025-02-14 20:01:14 -06:00
ekzyis
0032e064b2
Automated retries (#1776)
* Poll failed invoices with visibility timeout

* Don't return intermediate failed invoices

* Don't retry too old invoices

* Retry invoices on client

* Only attempt payment 3 times

* Fix fallbacks during last retry

* Rename retry column to paymentAttempt

* Fix no index used

* Resolve TODOs

* Use expiring locks

* Better comments for constants

* Acquire lock during retry

* Use expiring lock in retry mutation

* Use now() instead of CURRENT_TIMESTAMP

* Cosmetic changes

* Immediately show failed post payments in notifications

* Update hasNewNotes

* Never retry on user cancel

For a consistent UX and less mental overhead, I decided to remove the exception for ITEM_CREATE where it would still retry in the background even though we want to show the payment failure immediately in notifications.

* Fix notifications without pending retries missing if no send wallets

If a stacker has no send wallets, they would miss notifications about failed payments because they would never get retried.

This commit fixes this by making the notifications query aware if the stacker has send wallets. This way, it can tell if a notification will be retried or not.

* Stop hiding userCancel in notifications

As mentioned in a previous commit, I want to show anything that will not be attempted anymore in notifications.

Before, I wanted to hide manually cancelled invoices but to not change experience unnecessarily and to decrease mental overhead, I changed my mind.

* Also consider invoice.cancelledAt in notifications

* Always retry failed payments, even without send wallets

* Fix notification indicator on retry timeout

* Set invoice.updated_at to date slightly in the future

* Use default job priority

* Stop retrying after one hour

* Remove special case for ITEM_CREATE

* Replace retryTimeout job with notification indicator query

* Fix sortTime

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-02-14 19:25:11 -06:00
k00b
f4040756b3 fix graphql errors in notifications 2025-02-14 15:10:15 -06:00
soxa
1afadbdf3b
enhance: referral notifications with source (#1862)
* wip: referral notification shows source of referral

* simpler approach for source info gathering

* fix territory representation; fix fragment field

* cleanup; fix UI

* better margin approach

* hotfix: null check

* add support for comments

* use Union to represent ReferralSource; clarify with switch statements

* cleanup: compact switch statement on Referral resolver

* wip use refereeLanding

* add comments; cleanup

* hotfix: backwards compatibility for Earnings calculation

* small copy and semantics changes

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-02-11 20:02:04 -06:00
soxa
5c2aa979ea
feat: comment fee control (#1768)
* feat: comment fee control

* update typeDefs for unarchiving territories

* review: move functions to top level; consider saloon items

* ux: cleaner post/reply cost section

* hotfix: handle salon replies

* bios don't have subs + simplify root query

* move reply cost to accordian

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-02-07 13:38:57 -06:00
k00b
9885bcf209 make sure comments specify time zone for invoicePaidAt fix #1859 2025-02-03 19:40:33 -06:00
Keyan
074f0c0634
If we are a hop hint, use alternate form of estimateRouteFee (#1854)
* untested draft

* handle empty routes
2025-01-31 20:19:21 -06:00
Keyan
01b021a337
comment pagination with limit/offset (#1824)
* basic query with limit/offset

* roughly working increment

* working limiting/pageable queries

* denormalize direct comments + full comments below threshold

* notifications in megathread + working nest view more buttons

* fix empty comment footer

* make comments nested resolver again

* use time in cursor to avoid duplicates

* squash migrations

* do not need item.comments undefined checks
2025-01-29 19:00:05 -06:00
ekzyis
c023e8d7d5
Fix missing push notifications for thread subscriptions (#1843)
* Fix missing push notifications for thread subscriptions

* Filter by comments in calling context

* Fix mutes not considered

* Fix duplicate push notification (reply+thread subscription) sent
2025-01-25 13:47:58 -06:00
soxa
47faef872d
Subscribe unarchiver to unarchived territory (#1839)
* enhance: subscribe unarchiver to unarchived territory

* use upsert and fix #1517

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-01-22 19:11:19 -06:00
ekzyis
ca7726fda5
Fix recent sort order for retried items (#1829)
* Fix recent sort order for retried items

* Also fix for comments

* don't hide createdAt, order item query inner subquery

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-01-22 17:42:18 -06:00
soxa
a92215ccf6
fix: globally pinned items rank in global (#1814)
* fix: globally pinned items rank in global; use query to filter global pinned items

* cleanup

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-01-22 15:23:21 -06:00
k00b
7daf688ea3 remove p2p zap notification indicator fixing 'phantom' notifications 2025-01-08 18:10:14 -06:00
soxa
466620ff05
fix: zapping too fast causes duplicate notifications (#1812)
* fix: zapping too fast causes duplicate notifications

* add comment

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-01-08 12:51:07 -06:00
ekzyis
c74107269d
Fix job edits (#1811) 2025-01-06 17:20:14 -06:00
k00b
529b5d1fef fix #1795 2025-01-04 19:31:25 -06:00
Keyan
146b60278c
cowboy credits (aka nov-5 (aka jan-3)) (#1678)
* wip adding cowboy credits

* invite gift paid action

* remove balance limit

* remove p2p zap withdrawal notifications

* credits typedefs

* squash migrations

* remove wallet limit stuff

* CCs in item detail

* comments with meCredits

* begin including CCs in item stats/notifications

* buy credits ui/mutation

* fix old /settings/wallets paths

* bios don't get sats

* fix settings

* make invites work with credits

* restore migration from master

* inform backend of send wallets on zap

* satistics header

* default receive options to true and squash migrations

* fix paidAction query

* add nav for credits

* fix forever stacked count

* ek suggested fixes

* fix lint

* fix freebies wrt CCs

* add back disable freebies

* trigger cowboy hat job on CC depletion

* fix meMsats+meMcredits

* Update api/paidAction/README.md

Co-authored-by: ekzyis <ek@stacker.news>

* remove expireBoost migration that doesn't work

---------

Co-authored-by: ekzyis <ek@stacker.news>
2025-01-03 10:33:07 -06:00
ekzyis
077727dced
Fix expirein used instead of keepuntil (#1788)
* Fix expirein used instead of keepuntil

* Fix existing boost jobs
2025-01-03 08:52:34 -06:00
ekzyis
d53bc09773
Distinguish invoices cancelled by user (#1785) 2025-01-02 11:53:05 -06:00
ekzyis
6a02ea8c5c
Allow cancel of own invoices without hmac (#1787) 2025-01-02 10:35:54 -06:00
ekzyis
bec27a5a0e
Fix user since if first item wasn't paid (#1773) 2024-12-30 16:33:17 -06:00
ekzyis
c89220dbde
Add exclusion constraint to prevent duplicate items within 10m (#1747)
* Add exclusion constraint to prevent duplicate items within 10m

* Fix missing extension

* More user-friendly error message

* Use MD5 for slightly better performance

* Always use MD5 for columns of type TEXT

* shift constraint into the future

---------

Co-authored-by: k00b <k00b@stacker.news>
2024-12-28 10:33:53 -06:00
ekzyis
9783df8e3b
Require invite limit (#1748)
* Fix invite limit required

* Fix redeeming of unlimited invites

* Require invite limit
2024-12-28 09:28:05 -06:00
k00b
74f771adf4 fix #1754 2024-12-27 19:06:30 -06:00
ekzyis
fdbe14d195
Fix send-only wallet save after device sync enabled (#1732)
* Rename walletData to recvConfig

* Use nested upsert during wallet update
2024-12-19 11:31:11 -06:00
ekzyis
d3a705d3ad
Fix admin edits (#1737) 2024-12-18 18:28:18 -06:00
Keyan
6d4dfddae8
improve rewards (#1731)
* don't bias to early zapping so much

* untested rewards/leaderboard changes

* fix cln dep for payments

* make zap proportion scale using quad root

* fix for missing proportion on hidden users

* improve rewards cutoff criteria

* Update api/resolvers/user.js

Co-authored-by: ekzyis <ek@stacker.news>

* Update api/typeDefs/user.js

Co-authored-by: ekzyis <ek@stacker.news>

* improve switch readability

* small increase in min zap

* refresh materialized views on migration

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-12-18 10:12:11 -06:00
ekzyis
6098d39574
Fix missing logs on save (#1729)
* Fix missing logs on save

* fix receive logs wrt device sync

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-12-16 17:37:31 -06:00
ekzyis
62a922247d
Add timeouts to all wallet API calls (#1722)
* Add timeout to all wallet API calls

* Pass timeout signal to wallet API

* Fix timeout error message not shown on timeout

* Fix cross-fetch throws generic error message on abort

* Fix wrong method in error message

* Always use FetchTimeoutError

* Catch NDK timeout error to replace with custom timeout error

* Also use 15s for NWC connect timeout

* Add timeout delay
2024-12-16 14:05:31 -06:00
ekzyis
77d22cfd77
Remove unused wallet context args (#1724) 2024-12-14 08:55:08 -06:00
ekzyis
66b7352bf0
Fix forever edits (#1716)
* Fix forever edits

* Refactor edit check on server
2024-12-12 09:35:30 -06:00
k00b
98fae6c9ae prioritize payment reliability 2024-12-11 15:38:38 -06:00
ekzyis
a46f81f1e1
Receiver fallbacks (#1688)
* Use same naming scheme between ln containers and env vars

* Add router_lnd container

* Only open channels to router_lnd

* Use 1sat base fee and 0ppm fee rate

* Add script to test routing

* Also fund router_lnd wallet

* Receiver fallbacks

* Rename to predecessorId

* Remove useless wallet table join

* Missing renaming to predecessor

* Fix payment stuck on sender error

We want to await the invoice poll promise so we can check for receiver errors, but in case of sender errors, the promise will never settle.

* Don't log failed forwards as sender errors

* fix check for receiver error

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-12-10 14:15:29 -06:00
soxa
3806dc23af
enhance: show an error when uploads are expired (#1685)
* enhance: show an error when uploads are expired

* lint: standardjs
2024-12-05 08:15:08 -06:00
Keyan
713227b255
invite paid action (#1681) 2024-12-04 12:10:30 -06:00
k00b
909853521d item referral threshold 2024-12-02 14:45:15 -06:00
Riccardo Balbo
7f11792111
Custom invite code and note (#1649)
* Custom invite code and note

* disable autocomplete and hide invite code under advanced

* show invite description only to the owner

* note->description and move unser advanced

* Update lib/validate.js

Co-authored-by: ekzyis <ek@stacker.news>

* Update lib/webPush.js

Co-authored-by: ekzyis <ek@stacker.news>

* Update api/typeDefs/invite.js

Co-authored-by: ekzyis <ek@stacker.news>

* Update pages/invites/index.js

Co-authored-by: ekzyis <ek@stacker.news>

* Update pages/invites/index.js

Co-authored-by: ekzyis <ek@stacker.news>

* fix

* apply review suggestions

* change limits

* Update lib/validate.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* don't show invite id in push notification

* remove invoice metadata from push notifications

* fix form reset, jsx/dom attrs, accidental uncontrolled prop warnings

* support underscores as we claim

* increase default gift to fit inflation

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-12-01 16:31:47 -06:00
soxa
0b97d2ae94
fix: top boosts shows others' unpaid boosts (#1647) 2024-11-30 19:06:10 -06:00
ekzyis
0837460c53
Fix missing authentication check for invite revocation (#1666)
* Fix missing authentication check for invite revocation

* Toast invite revocation error
2024-11-30 12:08:30 -06:00
Lorenzo
7cb2aed9db
feat: recent unpaid bounties selection (#1589)
* feat: recent unpaid bounties selection

* chore: added checkbox on recent header

* chore: active bounties selection made through a checkbox

* chore: renamed function for better clarity

* chore: fixed active bounties only checkbox alignment

* chore: active-only option passed as query param

* chores: variablesFunc refactoring

* chore: removed type mapping function from recent header

* chore: router replace instead of push

* chore: router retrieved by hook instead of argument

* chore: checkbox starts checked based on url's query param

* more idiomatic react + push instead of replace

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-11-28 18:47:01 -06:00
ekzyis
7a8db53ecf Only retry same receiver if forward did not fail 2024-11-27 23:00:27 +01:00
ekzyis
b301b31a46 Create wrapped invoices on p2p zap retries 2024-11-27 23:00:27 +01:00
ekzyis
7f5bb33073 Fix payment method returned by retries 2024-11-27 23:00:27 +01:00
ekzyis
be4ce5daf9 Allow retries of pessimistic actions 2024-11-27 23:00:27 +01:00
Keyan
0bff478d39
direct receives and send paid action (#1650)
* direct receives and send paid action

* remove withdrawl->invoiceForward has many relationship

* fix formatMsats implicit type expectations

* ui + dropping direct payment bolt11s

* squash migrations

* fix bolt11 dropping and improve paid action wallet logging

* remove redundant sender id

* fix redirect when funding account over threshold

* better logging
2024-11-27 07:39:05 -06:00
ekzyis
8b5e13236b
Fix inconsistent actionArgs on retry (#1651) 2024-11-26 07:39:05 -06:00
ekzyis
923ddb74ca
Use invoice.cancelledAt to determine if invoice expired or was canceled by user (#1631)
* Set and resolve invoice.cancelledAt

* Don't close modal if invoice expired
2024-11-22 08:25:20 -06:00
Riccardo Balbo
eb3efbef57
HOTFIX: restore missing link between lnurlp and nip57 (#1630)
* restore missing link between lnurlp and nip57

* pass noteStr as receive action arg

* make sure the desc field is not updated if noteStr is unset
2024-11-21 08:46:28 -06:00
k00b
09bacdc016 catch wrap invoice error as noninvoiceable 2024-11-20 14:47:22 -06:00