Commit Graph

164 Commits

Author SHA1 Message Date
keyan 3160a3f66f prevent redoing queries for notifications 2023-10-22 17:51:07 -05:00
keyan f9f13cc752 update checkedNotesAt when there are none 2023-10-22 17:38:24 -05:00
keyan 1a33c8778b hasnewnotes query cleanup 2023-10-22 12:47:46 -05:00
keyan 4d7d4c28f9 user new create_item and remove double check for replies 2023-10-22 12:19:11 -05:00
Satoshi Nakamoto a6d3ca09e9 Don't include your own comments when determining if there are new thread
subscription replies for user hasNewNotes
2023-10-13 20:23:57 -04:00
SatsAllDay 502bfee072
Mention auto-complete (#532)
* uber rough first pass at mention autocompletes

* support custom limit on topUsers query

* hot keys for selecting user suggestion in markdown input

* query top stackers for mentions with no search query

* refactor UserSuggestion to help with reusability

textarea-caret for placing the user suggest dropdown appropriately

other various code cleanup items to make it easier to use

off by one errors are fun!

various code cleanup and reuse the UserSuggest component in InputUserSuggest to reduce duplication

* change default users to week query

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-04 15:10:56 -05:00
keyan dfe859eb92 fix top user stack amount to only include tips 2023-09-28 16:26:06 -05:00
keyan 4bd489a36a mutes 2023-09-28 15:02:25 -05:00
keyan 370e3c1c48 raise boost minimum to 25k, enhance editing boost, JIT fund editing costs 2023-09-25 19:54:35 -05:00
keyan 2afb8dc231 fix deposits not showing up in notifications 2023-09-18 19:30:26 -05:00
SatsAllDay bc2363dfab
Verified contributors (#474)
* `isContributor`, `hideIsContributor` user fields and basic UI decoration on profile page

* Update verified contributor decoration on profile page

* Add contributors instructions

* update setting label

* Remove `isContributor` from DB, load contributors from file into memory

* fix merge error

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-18 13:57:02 -05:00
SatsAllDay 8ab58fff87
Proposal: User Subscriptions: separate posts and comments (#470)
* Subscribe to user posts and comments independently

* Track when comments and posts subscriptions are set to filter out old items

* Only send push notification to subscribed user if posts/comments enabled

* Remove `posts` and `comments` boolean fields on UserSub, rely solely on timestamps
2023-09-18 13:20:02 -05:00
SatsAllDay 94fbabcdf9
Notifications for when you are forwarded sats from a post (#467)
* Notifications for when you are forwarded sats from a post

Support notifications when a post for which you are forwarded gets zapped

This is controlled by a new boolean flag in user settings

* Send push notifications to forwarded users when they get forwarded sats

* Add `Promise.allSettled` per PR feedback

* Remove `FEE` act type when building forwarded zaps notifications

Don't include `FEE` actions, only `TIP` actions to avoid "0 sats forwarded" notifications

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-12 10:31:46 -05:00
rleed 2ba969ebab
Add new visitor welcome banner (#418)
* add new visitor welcome banner

* show dismissible banner on first-time login

* add mutation to hide welcome banner

* Update components/banners.js

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>

* fix error handling

* simplifications and other review suggestions

* cleanup

* restore selective display logic

* remove unnecessary query arguments

* cleanup a bit more

* don't show welcome banner to existing stackers

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-11 16:29:45 -05:00
keyan b7d0a373f4 don't notify for hold invoices 2023-08-31 11:38:45 -05:00
SatsAllDay 0d4a225442
Subscribe to a user (#443)
* First pass of user subscriptions

* add new db model to track subscriptions
* update user typedef and api resolver for subscription state
* add subscribe action to user profile page
* add mutation to subscribe to a user

* Update notifications queries, hasNewNotes queries for FollowActivity note type

* Only show items that have been created since subscribing to the user

* Send push notifications to user subscribers for posts and comments

* Rename item dropdown to action dropdown and re-use for item info and user actions

* Don't allow self-follows

* Add index on followee for faster lookups

* Don't show subscribe action if not logged in

* small style enhance

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-28 20:27:56 -05:00
keyan 781d034422 fix top cowboy nulls 2023-08-28 20:12:33 -05:00
keyan 2e846af737 fix bio 2023-08-27 17:48:46 -05:00
keyan 61c7bb28c2 allow name checking if you aren't logged in 2023-08-25 14:22:02 -05:00
keyan df6575d701 remove slashtags completely 2023-08-17 13:40:21 -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 7369bd819d
Add nostr login (#367)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-07 19:50:01 -05:00
keyan 5232b59625 upgrade to next-auth 4 (bonus: improve error pages) 2023-07-29 14:38:20 -05:00
keyan 7542dd6cc4 upgrade to prisma 4 2023-07-26 19:18:42 -05:00
keyan 672853a7ea upgrade to prisma 3 2023-07-26 11:01:31 -05:00
keyan 59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed.
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 d0314ab73c.
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 8536660580
Fix maxStreak for users with running best streak (#356)
Co-authored-by: ekzyis <ek@stacker.news>
2023-07-14 10:49:16 -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 d815cae715 add 'stacking since' to profile 2023-06-02 19:55:45 -05:00
keyan c93ae90578 remove extra note checking condition 2023-06-01 14:54:44 -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 f6ab939bcc use mat views (tm) for historicals (tm) 2023-05-19 17:38:39 -05:00
keyan 7b60dc5e9f use getItem meta helper more places 2023-05-07 15:21:58 -05:00
keyan 3c8ea0db22 reduce io blocking ssr 2023-05-07 10:44:57 -05:00
keyan cd9c0086ef fix top users missing return field 2023-05-02 17:02:08 -05:00
keyan 4be5286122 hide cowboy hat setting 2023-05-01 16:52:02 -05: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 4cae1ae230 reuse validation on server 2023-02-08 13:39:53 -06:00
keyan 3a9994a9a6 denormalize user streak to avoid extra dip 2023-02-03 14:40:30 -06:00
keyan d24b0727ea fix streak length time zone 2023-02-01 18:09:28 -06:00
keyan 072e60c954 streaks 2023-02-01 17:40:49 -06:00
keyan 9644a9f867 slashtags auth 2023-01-18 12:49:20 -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 e1bdb9c769 donations to rewards 2022-12-07 18:04:02 -06:00
keyan a2db3e18b4 better user analytics mostly 2022-12-01 15:31:04 -06:00
keyan 7df375e752 improvements to jobs 2022-11-29 11:29:43 -06:00
keyan 5746160893 let tips affect ranking 2022-11-23 12:12:09 -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 6c9f4f1c3a for top users constrain other stats 2022-10-26 09:56:22 -05:00
keyan a398784f26 improved top 2022-10-25 16:35:32 -05:00
keyan 30b1ee33aa user search 2022-10-25 12:13:06 -05:00
keyan 46ea2f661c make jobs great again 2022-09-29 15:42:33 -05:00
keyan d9d426e5c3 add freebies 2022-09-27 16:19:15 -05:00
keyan 7faae425b3 wild west mode 2022-09-21 14:57:36 -05:00
keyan 48990d5987 when linking email store as lowercase 2022-09-12 14:10:15 -05:00
keyan 7efc86427d maintage pagination and other state on back button 2022-09-06 08:32:00 -05:00
keyan a5d1d8dc0f user suggestions on forward 2022-08-31 14:09:49 -05:00
keyan 04d9c45156 server side validate nym 2022-08-26 17:26:42 -05:00
keyan 388c7d0240 full powered editing 2022-08-18 13:15:24 -05:00
keyan 93a19839cf add earning to top stacking users 2022-07-13 19:55:10 -05:00
keyan 1df49e03d9 account linking 2022-06-08 16:26:44 -05:00
keyan dea34e0b93 only check tips and votes for notifications 2022-05-18 11:43:37 -05:00
keyan 29fb37b763 profile photos 2022-05-16 15:51:22 -05:00
keyan aa4ac2ecc9 add ln addr + lnurl pay qr code to profile pages 2022-05-06 14:34:35 -05:00
keyan 771978d562 sub to newsletter on sign up 2022-05-04 13:29:30 -05:00
keyan 798b055fb9 remove unecessary queries on resp critical path 2022-05-01 20:01:33 -05:00
keyan dc44764008 limit related queries in me query for SSR 2022-04-28 17:00:09 -05:00
keyan 934c5021a9 a few perf enhancements + gql slowlogs 2022-04-28 13:11:05 -05:00
keyan 188230c37c add notification settings 2022-04-21 17:50:02 -05:00
keyan c284e18278 denormalize stacked count 2022-04-04 16:54:31 -05:00
keyan 987a5ed3a3 notify user when invoice is paid 2022-03-23 13:54:39 -05:00
keyan 7a78210cb6 improvements to earning 2022-03-18 07:29:02 -05:00
keyan 5ff856d061 earning 2022-03-17 15:13:19 -05:00
keyan 46f552b803 store last time user visited so we can guage retention 2022-03-14 11:43:21 -05:00
keyan cd3125954e make sure it's the user's job 2022-03-01 11:08:44 -06:00
keyan 50f10550b8 fix checkedNotesAt issue 2022-03-01 11:04:44 -06:00
keyan 022c72b95b remove extra migrations, refine jobs 2022-02-28 14:09:21 -06:00
keyan 3fb7ab9cd7 fix integer overflow 2022-02-26 15:42:38 -06:00
keyan 8829fccdef add top spenders to top page 2022-02-02 16:01:48 -06:00
keyan e97951dd18 notify on any descendant replies 2022-01-30 09:35:57 -06:00
keyan 6b19b10bb2 invite notifications 2022-01-19 15:02:38 -06:00
keyan 7d4324eb33 exclude users spent sats from their stacked count 2022-01-19 10:36:00 -06:00
keyan ccc1251f7e drop theme from users table 2022-01-14 11:42:45 -06:00
keyan 01ee9cdd1c don't ever reveal user wallet balances to other users 2021-12-30 16:02:18 -06:00
keyan 3e17eb1688 top users query 2021-12-16 18:01:02 -06:00
keyan 4d3ab603da tip walkthrough 2021-12-09 14:41:09 -06:00
keyan 3bbf3f7470 add dark mode 2021-11-04 19:07:41 -04:00
keyan 2eaf407f17 add settings page 2021-10-30 11:20:11 -05:00
keyan 955d1aa1b2 finish up invites 2021-10-15 18:07:51 -05:00
keyan a339516a54 user bios mostly working 2021-09-24 16:28:21 -05:00
keyan 027ba6a048 WIP user bio 2021-09-23 17:18:48 -05:00
keyan 56a3dc9793 make bio form just a textarea 2021-09-23 15:25:38 -05:00
keyan e7787e3e67 WIP bios 2021-09-23 12:42:00 -05:00
keyan 93428e3183 tips WIP 2021-09-08 16:51:23 -05:00