* Convert all top-level arrow functions to regular functions
* Refactor webPush.sendNotification call
* Refactor webPush logging
* Rename var to title
* Rewrite service worker
This rewrite simplifies the service worker by removing
* merging of push notifications via tag property
* badge count
These features weren't properly working on iOS. We concluded that we don't really need them.
For example, this means replies will no longer get merged to "you have X new replies" but show up as individual notifications.
Only zaps still use the tag property so devices that support it can still replace any previous "your post stacked X sats" notification for the same item.
* Don't use async/await in service worker
* Support app badge count
* Fix extremely slow notificationclick
* Fix serialization and save in pushsubscriptionchange event
* Remove service worker logger
* Use async/await for togglePushSubscription
* Remove commented out logger calls in service worker
* Remove message channel between service worker and app
The listener for messages from the service worker was removed in a previous commit.
* Remove unused OS detection for service worker
* set boost max
* reduce max and apply to boost act
* make boost position aware paid action state
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
* Remove gun+horse streak
* Add wallet badges
* Fix empty recv wallet detected as enabled
* Resolve badges via columns and triggers
* Fix backwards compatibility by not dropping GQL fields
* Gun+horse notifications as streaks via triggers
* Fix error while computing streaks
* Push notifications for horse+gun
* Move logic to JS via pgboss job
* Fix argument to notifyNewStreak
* Update checkWallet comment
* Refactor notification id hack
* Formatting
* Fix missing update of possibleTypes
This didn't cause any bugs because the added types have no field resolvers.
* Add user migration
* Fix missing cast to date
* Run checkWallet queries inside transaction
* Refactor reminder push notifications
items should always exist and if not, we can just immediately fail imo
* Use same text for reminders in /notifications
* Reset multi auth to initial state
* Also check if next-auth.session-token exists
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
* multi_auth cookies check + reset
* multi_auth cookies refresh
* Expire cookies after 30 days
This is the actual default for next-auth.session-token.
* Collapse issues by default
* Only refresh session cookie manually as anon
* fix mangled merge
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
* 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>
* Fix the check for misleading links
* replace tabs with spaces
* remove trailing spaces
* move isMisleadingLinks to lib/url.js and create unit tests
* Add comments to test cases
* URLs can contain hyphens
---------
Co-authored-by: ekzyis <ek@stacker.news>
* fix: cannot login with email on PWA
* adjust other email templates
* restore manual url on new user email
* no padding on button section
* cleanup
* generate 6-digit bechh32 token
* token needs to be fed as lower case; validator case insensitive
* delete token if user has failed 3 times
* proposal: context-independent error page
* include expiration time on email page message
* add expiration time to emails
* independent checkPWA function
* restore token deletion if successful auth
* final cleanup: remove unused function
* compact useVerificationToken
* email.js: magic code for non-PWA users
* adjust email templates
* MultiInput component; magic code via MultiInput
* hotfix: revert length testing; larger width for inputs
* manual bech32 token generation; no upperCase
* reverting to string concatenation
* layout tweaks, fix error placement
* pastable inputs
* small nit fixes
* less ambiguous error path
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
* 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
* 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
* fix: duplicate notification on subscribed user and territory
* fix comments not showing up, adjust query
* use and tagged template helpers
---------
Co-authored-by: k00b <k00b@stacker.news>