239 Commits

Author SHA1 Message Date
SatsAllDay
3da395a792
multiple forwards on a post (#403)
* multiple forwards on a post

first phase of the multi-forward support

* update the graphql mutation for discussion posts to accept and validate multiple forwards

* update the discussion form to allow multiple forwards in the UI

* start working on db schema changes

* uncomment db schema, add migration to create the new model, and update create_item, update_item
stored procedures

* Propagate updates from discussion to poll, link, and bounty forms

Update the create, update poll sql functions for multi forward support

* Update gql, typedefs, and resolver to return forwarded users in items responses

* UI changes to show multiple forward recipients, and conditional upvote logic changes

* Update notification text to reflect multiple forwards upon vote action

* Disallow duplicate stacker entries

* reduce duplication in populating adv-post-form initial values

* Update item_act sql function to implement multi-way forwarding

* Update referral functions to scale referral bonuses for forwarded users

* Update notification text to reflect non-100% forwarded sats cases

* Update wallet history sql queries to accommodate multi-forward use cases

* Block zaps for posts you are forwarded zaps at the API layer, in addition
to in the UI

* Delete fwdUserId column from Item table as part of migration

* Fix how we calculate stacked sats after partial forwards in wallet history

* Exclude entries from wallet history that are 0 stacked sats from posts with 100% forwarded to other users

* Fix wallet history query for forwarded stacked sats to be scaled by the fwd pct

* Reduce duplication in adv post form, and do some style tweaks for better layout

* Use MAX_FORWARDS constants

* Address various PR feedback

* first enhancement pass

* enhancement pass too

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-08-23 17:44:17 -05:00
SatsAllDay
ee3f892053
Add new user setting to hide bookmarks from other users (and anon) (#424)
* Add new setting to hide bookmarks from other users (and anon)

* Optional chaining in case user doesnt exist, and avoid duplicate sql query in some cases
2023-08-23 15:29:55 -05:00
keyan
ddb69b5d9b remove slashtags temporarily 2023-08-16 19:49:00 -05:00
ekzyis
670c567bff
Configure imgproxy timeouts + add click to load on imgproxy errors (#404)
* Configure imgproxy timeouts

* Use click to load on imgproxy errors

* Add setting for click to load

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-08-15 12:55:16 -05:00
keyan
e4831e65d5 show sources and history of rewards 2023-08-15 12:41:51 -05:00
ekzyis
b9461b7eb3
Allow zapping, posting and commenting without funds or an account (#336)
* Add anon zaps

* Add anon comments and posts (link, discussion, poll)

* Use payment hash instead of invoice id as proof of payment

Our invoice IDs can be enumerated.
So there is a - even though very rare - chance that an attacker could find a paid invoice which is not used yet and use it for himself.
Random payment hashes prevent this.

Also, since we delete invoices after use, using database IDs as proof of payments are not suitable.
If a user tells us an invoice ID after we deleted it, we can no longer tell if the invoice was paid or not since the LN node only knows about payment hashes but nothing about the database IDs.

* Allow pay per invoice for stackers

The modal which pops up if the stacker does not have enough sats now has two options: "fund wallet" and "pay invoice"

* Fix onSuccess called twice

For some reason, when calling `showModal`, `useMemo` in modal.js and the code for the modal component (here: <Invoice>) is called twice.

This leads to the `onSuccess` callback being called twice and one failing since the first one deletes the invoice.

* Keep invoice modal open if focus is lost

* Skip anon user during trust calculation

* Add error handling

* Skip 'invoice not found' errors

* Remove duplicate insufficient funds handling

* Fix insufficient funds error detection

* Fix invoice amount for comments

* Allow pay per invoice for bounty and job posts

* Also strike on payment after short press

* Fix unexpected token 'export'

* Fix eslint

* Remove unused id param

* Fix comment copy-paste error

* Rename to useInvoiceable

* Fix unexpected token 'export'

* Fix onConfirmation called at every render

* Add invoice HMAC

This prevents entities which know the invoice hash (like all LN nodes on the payment path) from using the invoice hash on SN.

Only the user which created the invoice knows the HMAC and thus can use the invoice hash.

* make anon posting less hidden, add anon info button explainer

* Fix anon users can't zap other anon users

* Always show repeat and contacts on action error

* Keep track of modal stack

* give anon an icon

* add generic date pivot helper

* make anon user's invoices expire in 5 minutes

* fix forgotten find and replace

* use datePivot more places

* add sat amounts to invoices

* reduce anon invoice expiration to 3 minutes

* don't abbreviate

* Fix [object Object] as error message

Any errors thrown here are already objects of shape { message: string }

* Fix empty invoice creation attempts

I stumbled across this while checking if anons can edit their items.

I monkey patched the code to make it possible (so they can see the 'edit' button) and tried to edit an item but I got this error:

  Variable "$amount" of required type "Int!" was not provided.

I fixed this even though this function should never be called without an amount anyway. It will return a sane error in that case now.

* anon func mods, e.g. inv limits

* anon tips should be denormalized

* remove redundant meTotalSats

* correct overlay zap text for anon

* exclude anon from trust graph before algo runs

* remove balance limit on anon

* give anon a bio and remove cowboy hat/top stackers;

* make anon hat appear on profile

* concat hash and hmac and call it a token

* Fix localStorage cleared because error were swallowed

* fix qr layout shift

* restyle fund error modal

* Catch invoice errors in fund error modal

* invoice check backoff

* anon info typo

* make invoice expiration times have saner defaults

* add comma to anon info

* use builtin copy input label

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-11 18:50:57 -05:00
ekzyis
67a0de3ea5
Notifications with nostr info (#368)
* Show zap message and pubkey in notifications

+ show zap request event in invoice view

* enhance ui

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-08 13:19:31 -05:00
ekzyis
7369bd819d
Add nostr login (#367)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-07 19:50:01 -05:00
keyan
8ab018af88 fix nested comment sorting 2023-07-25 19:45:35 -05:00
keyan
59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed470fe12ffbfb83df18e206101f0a05.
2023-07-23 10:08:43 -05:00
keyan
18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c42ebf85fe2f418dddd681af45dbc55.
2023-07-23 09:16:12 -05:00
keyan
d0314ab73c shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades 2023-07-21 17:33:11 -05:00
ekzyis
0d3328e509
Show longest cowboy streak in profile (#353)
* Show longest cowboy streak in profile

* Fix image offset

* Initialize maxStreak for every user

* Use resolver instead of denormalization for maxStreak

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-12 19:10:29 -05:00
keyan
efa3172f15 top stackers sorted stat to front 2023-07-10 12:59:21 -05:00
keyan
4e9138dfdc show more info on where zap rewards came from 2023-07-09 12:21:11 -05:00
keyan
f0f51438c4 add top posts/comments to subs 2023-06-12 19:40:18 -05:00
keyan
369bd82a84 make freebie comments visible case by case 2023-06-03 20:01:50 -05:00
keyan
d815cae715 add 'stacking since' to profile 2023-06-02 19:55:45 -05:00
ekzyis
0c251ca376
Add thread subscriptions (#293)
* Add thread subscriptions

* remove dead code: reply only notifications

* break out thread subscription queries to reduce search space

* one db dip for item lists/threads re:meSubscription

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-05-31 19:44:06 -05:00
keyan
225e472dd7 add root fields to flat comments on user 2023-05-06 20:40:42 -05:00
keyan
a97f8229b0 avoid extra dip when getting users 2023-05-06 18:18:18 -05:00
keyan
347a6a54d2 improve comment performance 2023-05-06 16:51:17 -05:00
keyan
b406f0c340 avoid db dip for sub 2023-05-05 12:39:57 -05:00
keyan
abd9555792 fix recent comments 2023-05-04 19:20:48 -05:00
keyan
4be5286122 hide cowboy hat setting 2023-05-01 16:52:02 -05:00
keyan
a241d683d8 nostr sub 2023-05-01 15:58:30 -05:00
keyan
0c2b9a31b2 ots timestamp link on comments 2023-02-24 10:02:20 -06:00
keyan
16bf7007cc put opentimestamps link in item dropdown 2023-02-16 17:07:20 -06:00
ekzyis
7b838cdeb2
Implement bookmarking of posts and comments (#235) 2023-02-16 16:23:59 -06:00
keyan
97f74da0fd top cowboys 2023-02-09 12:41:28 -06:00
keyan
a5b2de64d3 remove bolt on posts forwarding to self 2023-02-08 18:11:28 -06:00
keyan
36ddb25b46 remove extra queries 2023-02-03 18:08:08 -06:00
keyan
c1080ec4d7 fixes for top 2023-02-03 13:10:18 -06:00
keyan
072e60c954 streaks 2023-02-01 17:40:49 -06:00
ekzyis
4ab66a67ae
Add proxy with cache for coinbase API requests (#226) 2023-01-27 17:20:33 -06:00
keyan
5306b11157 improve bounty performance 2023-01-26 13:09:57 -06:00
Austin Kelsay
e13e37744e
stackernews bounties (#227)
bounties
2023-01-26 10:11:55 -06:00
keyan
29c59d93ea open timestamps 2023-01-22 14:17:50 -06:00
keyan
9644a9f867 slashtags auth 2023-01-18 12:49:20 -06:00
keyan
10ff3fa1c3 delete 2023-01-13 11:52:18 -06:00
keyan
2d012ba7fe allow nip05 for users 2023-01-06 18:53:29 -06:00
keyan
ee17518abf add referrer stats to top 2022-12-19 17:00:53 -06:00
keyan
41226245c5 referrals 2022-12-19 16:27:52 -06:00
keyan
7b7ed0047c turbo tipping 2022-12-09 13:25:38 -06:00
keyan
2a4e5a0617 add more filters to recent 2022-12-01 16:42:49 -06:00
keyan
a2db3e18b4 better user analytics mostly 2022-12-01 15:31:04 -06:00
keyan
1bf747c7c0 sats to msats 2022-11-16 10:57:03 -06:00
keyan
8de00c741d poll for notifications less, don't retry gql 2022-11-16 10:57:03 -06:00
keyan
760b6b6e10 related items 2022-10-27 15:25:42 -05:00
keyan
6c9f4f1c3a for top users constrain other stats 2022-10-26 09:56:22 -05:00