Commit Graph

2586 Commits

Author SHA1 Message Date
keyan 0aa5ba4955 move invoice creation outside of interactive tx 2024-07-01 17:03:25 -05:00
keyan 6e8d7ef1b8 allow slog logs to be disabled/configured 2024-07-01 16:48:54 -05:00
ekzyis e57c930f0c
Fix push notifications (#1249)
* Fix wrong author in reply push notification

* Fix duplicate mentions push notifications on save

* Fix item mention push notification argument

* Fix zap push notification using stale msats
2024-07-01 15:51:59 -05:00
keyan 6e1d67b3c0 fix optimistic responses of bounties and poll votes 2024-07-01 14:58:53 -05:00
keyan 1e9d1ce66c fix zap optimistic response 2024-07-01 14:56:17 -05:00
Keyan ca11ac9fb8
backend payment optimism (#1195)
* wip backend optimism

* another inch

* make action state transitions only happen once

* another inch

* almost ready for testing

* use interactive txs

* another inch

* ready for basic testing

* lint fix

* inches

* wip item update

* get item update to work

* donate and downzap

* inchy inch

* fix territory paid actions

* wip usePaidMutation

* usePaidMutation error handling

* PENDING_HELD and HELD transitions, gql paidAction return types

* mostly working pessimism

* make sure invoice field is present in optimisticResponse

* inches

* show optimistic values to current me

* first pass at notifications and payment status reporting

* fix migration to have withdrawal hash

* reverse optimism on payment failure

* Revert "Optimistic updates via pending sats in item context (#1229)"

This reverts commit 93713b33df.

* add onCompleted to usePaidMutation

* onPaid and onPayError for new comments

* use 'IS DISTINCT FROM' for NULL invoiceActionState columns

* make usePaidMutation easier to read

* enhance invoice qr

* prevent actions on unpaid items

* allow navigation to action's invoice

* retry create item

* start edit window after item is paid for

* fix ux of retries from notifications

* refine retries

* fix optimistic downzaps

* remember item updates can't be retried

* store reference to action item in invoice

* remove invoice modal layout shift

* fix destructuring

* fix zap undos

* make sure ItemAct is paid in aggregate queries

* dont toast on long press zap undo

* fix delete and remindme bots

* optimistic poll votes with retries

* fix retry notifications and invoice item context

* fix pessimisitic typo

* item mentions and mention notifications

* dont show payment retry on item popover

* make bios work

* refactor paidAction transitions

* remove stray console.log

* restore docker compose nwc settings

* add new todos

* persist qr modal on post submission + unify item form submission

* fix post edit threshold

* make bounty payments work

* make job posting work

* remove more store procedure usage ... document serialization concerns

* dont use dynamic imports for paid action modules

* inline comment denormalization

* create item starts with median votes

* fix potential of serialization anomalies in zaps

* dont trigger notification indicator on successful paid action invoices

* ignore invoiceId on territory actions and add optimistic concurrency control

* begin docs for paid actions

* better error toasts and fix apollo cache warnings

* small documentation enhancements

* improve paid action docs

* optimistic concurrency control for territory updates

* use satsToMsats and msatsToSats helpers

* explictly type raw query template parameters

* improve consistency of nested relation names

* complete paid action docs

* useEffect for canEdit on payment

* make sure invoiceId is provided when required

* don't return null when expecting array

* remove buy credits

* move verifyPayment to paidAction

* fix comments invoicePaidAt time zone

* close nwc connections once

* grouped logs for paid actions

* stop invoiceWaitUntilPaid if not attempting to pay

* allow actionState to transition directly from HELD to PAID

* make paid mutation wait until pessimistic are fully paid

* change button text when form submits/pays

* pulsing form submit button

* ignore me in notification indicator for territory subscription

* filter unpaid items from more queries

* fix donation stike timing

* fix pending poll vote

* fix recent item notifcation padding

* no default form submitting button text

* don't show paying on submit button on free edits

* fix territory autorenew with fee credits

* reorg readme

* allow jobs to be editted forever

* fix image uploads

* more filter fixes for aggregate views

* finalize paid action invoice expirations

* remove unnecessary async

* keep clientside cache normal/consistent

* add more detail to paid action doc

* improve paid action table

* remove actionType guard

* fix top territories

* typo api/paidAction/README.md

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

* typo components/use-paid-mutation.js

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

* Apply suggestions from code review

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

* encorporate ek feeback

* more ek suggestions

* fix 'cost to post' hover on items

* Apply suggestions from code review

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

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-07-01 12:02:29 -05:00
ekzyis 30e29f709d
Add missing CANCELLED status (#1248) 2024-07-01 08:43:13 -05:00
keyan fb52d5314d fix missing subname on this day in sn 2024-06-30 11:45:06 -05:00
keyan 9e44baa7f5 make a this day in sn generator page 2024-06-29 18:06:02 -05:00
keyan 658fe73920 upgrade compatibility for #1195 2024-06-29 10:35:51 -05:00
keyan 4fc832c7ed don't import css into /lib 2024-06-25 17:18:21 -05:00
Keyan 1e3d37d6b0
Update awards.csv 2024-06-25 16:36:20 -05:00
nichro a95402e3be
Added support for <sub> <sup> in markdown (#1215)
* Add support for sub and superscript in markdown

* Removed empty line as per lint

* renamed schema to rehypeSanitizeSchema to make it less generic

* Linting fixes

* Update components/text.js

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

* Reverting changes: remove rehype-raw&sanitize, clean up

* Draft iteration of rehypeStyler plugin

* rehypeStyler visiting element nodes properly to catch tag-text-tag patterns

* Refreshed package-lock

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-06-25 14:23:18 -05:00
ekzyis ddaec36617
Fix litd healthcheck (#1246) 2024-06-24 20:28:42 -05:00
ekzyis 3f6581f119
Fix user popover if mention inside link (#1245) 2024-06-23 12:15:26 -05:00
ekzyis 923b21610f
Fix item mention ref pattern (#1244) 2024-06-23 12:14:11 -05:00
keyan 87e198cc04 add this day in stacker news to newsletter 2024-06-22 15:23:30 -05:00
Keyan a55e865222
Update awards.csv 2024-06-22 15:18:37 -05:00
Tom 4fe920d12b
Handle Peertube Embeds (#1223)
* Handle peertube embeds

* Permit full screen for Rumble and PeerTube

* Use sandbox='allow-scripts' for iframes

* Restore frame-src domains

* Use endsWith

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-06-20 11:28:25 -05:00
keyan 78520b787b dont use broken navigator.share on desktop safari 2024-06-14 13:44:36 -05:00
Keyan 8329da1f56
Update awards.csv 2024-06-13 16:40:16 -05:00
keyan b1f850ee0e clear email hash when email is unlinked 2024-06-13 12:14:08 -05:00
ekzyis 8a19fc0905
Use <Alert> for auth banner in /settings (#1238) 2024-06-12 18:16:54 -05:00
ekzyis 286f53f2b3
Update zap undos info (#1237) 2024-06-12 18:16:41 -05:00
ekzyis cbcae1d128
Fix downzaps (#1236)
* Add optimistic update for downzaps

* Add optimistic update for zaps via dropdown

* Also use lightning strike for downzaps
2024-06-12 13:24:04 -05:00
ekzyis 967b5b74fb
Fix anon payment verification (#1235)
* Enforce hash & hmac for anons in serialize

* Enforce logged in for idempotent zaps
2024-06-12 11:15:00 -05:00
ekzyis 93713b33df
Optimistic updates via pending sats in item context (#1229)
* Use context for pending sats

* Fix sats going negative on zap undo

We already handle undoing pending sats by wrapping the payment+mutation with try/finally.

* Remove unnecessary ItemContextProvider

* Rename to parentCtx

* Fix hierarchy of ItemContextProvider

If a comment was root and it was zapped, the pending sats contributed to the sats shown in <CommentsHeader>.

This was caused by <CommentsHeader> accessing the root item context for all comments, even for the root comment.

So even if the root comment was zapped, the pending sats contributed to the sats for the comment section.

This wasn't the case for posts since their item context was above the context used by <CommentsHeader>.

This was fixed by moving <ItemProviderContext> down into <Comments> and <Item> instead of declaring it at <ItemFull> which wraps the root item and all comments.

* Optimistic update for poll votes

* prevent twice optimistic zap

* enhance client notifications with skeleton and no redudant queries

* enlarge nwc amount limits

* Disable max amount and daily limit in NWC container

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-06-12 08:34:24 -05:00
Tom 569d0448c2
Remove toast error (#1231) 2024-06-11 11:22:20 -05:00
ekzyis 35be035850
More zap undo fixes III (#1228)
* Fix pending state not immediately updated

Before, the bolt wasn't rerendered if the user clicked again within the undo delay since no state changed.

* Fix zap undo pulse only shown on hover
2024-06-06 08:22:05 -05:00
ekzyis 09f9efa189
Remove strike delay (#1227) 2024-06-05 11:49:09 -05:00
ekzyis 79ed07ae74
Embed youtube shorts (#1225) 2024-06-05 09:08:27 -05:00
ekzyis 23c51df283
Revert reverse refs (#1224)
* Remove reverse internal refs

* Formatting
2024-06-05 08:21:01 -05:00
keyan 1dcb6461c7 give sndev logs better default params 2024-06-04 13:07:03 -05:00
keyan 2775b49ce7 fix inconsistency in url handling and don't let parseEmbedURL throw 2024-06-04 12:10:37 -05:00
ekzyis ea97fbf4a4
Avoid manual optimistic updates for now (#1220)
* Avoid manual optimistic zap updates for now

* Remove manual optimistic updates for pay-bounty and poll
2024-06-04 03:02:34 -05:00
ekzyis d8fe698963
Fix missing commentId parsing for item mentions (#1219) 2024-06-03 21:54:42 -05:00
keyan 061d3f220d fix local dev missing snl row 2024-06-03 16:55:03 -05:00
keyan c90eb055c7 fix performance of sub nested resolvers 2024-06-03 16:50:38 -05:00
keyan 7b667821d2 fix notification indicator for item mentions 2024-06-03 16:34:38 -05:00
Keyan b4c120ab39
Update awards.csv 2024-06-03 14:40:37 -05:00
SatsAllDay e3571af1e1
Make Polls Anonymous (#1197)
* make polls anonymous

Introduce a `PollBlindVote` DB table that tracks when a user votes in a poll,
but does not track which choice they made.

Alter the `PollVote` DB table to remove the `userId` column, meaning `PollVote`
now tracks poll votes anonymously - it captures votes per poll option,
but does not track which user submitted the vote.

Update the `poll_vote` DB function to work with both tables now.

Update the `item.poll` resolver to calculate `meVoted` based on the `PollBlindVote`
table instead of `PollVote`.

* remove `meVoted` on `PollOption`s

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-06-03 13:56:43 -05:00
ekzyis 2597eb56f3
Item mention notifications (#1208)
* Parse internal refs to links

* Item mention notifications

* Also parse item mentions as URLs

* Fix subType determined by referrer item instead of referee item

* Ignore subType

Considering if the item that was referred to was a post or comment made the code more complex than initially necessary.

For example, notifications for /notifications are deduplicated based on item id and the same item could refer to posts and comments, so to include "one of your posts" or "one of your comments" in the title would require splitting notifications based on the type of referred item.

I didn't want to do this but also wanted to have consistent notification titles between push and /notifications, so I use "items" in both places now, even though I think using "items" isn't ideal from a user perspective. I think it might be confusing.

* Fix rootText

* Replace full links to #<id> syntax in push notifications

* Refactor mention code into separate functions
2024-06-03 12:12:42 -05:00
Tom d454bbdb72
Fix issue with popover on full sn links (#1216)
* Fix issue with popover on full sn links

* allow custom text for internal links

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-06-03 12:05:31 -05:00
ekzyis 86b857b8d4
Allow SN users to edit special items forever (#1204)
* Allow SN users to edit special items

* Refactor item edit validation

* Create object for user IDs

* Remove anon from SN_USER_IDS

* Fix isMine and myBio checks

* Don't update author

* remove anon from trust graph

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-06-03 11:26:19 -05:00
SatsAllDay e9aa268996
add `fund_user` sndev command (#1214)
* add `fund_user` sndev command

* update help and set msats rather than add

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-06-03 09:37:58 -05:00
Keyan 3d3dc52cec
Update awards.csv 2024-05-31 10:23:31 -05:00
Tom 0576716c4a
Close related section (#1207)
* Fix issue with closing accordian

* Use onSelect

* Remove change to AccoridanCard

* Fix className typo

* Restore conditional
2024-05-31 10:20:52 -05:00
ekzyis a7bc757514
Use same button to generate and delete API keys (#1210) 2024-05-30 16:24:18 -05:00
ekzyis d2a981ca5d
Add bot badge to items created with API key (#1209) 2024-05-30 16:23:07 -05:00
ekzyis 050122c665
Use global score for top (#1202)
* Use global score for comments ordered by top

* Use global score for global top feed
2024-05-30 09:21:55 -05:00