Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nostr crossposting all item types #779

Merged
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7852c98
crosspost-item
AustinKelsay Nov 1, 2023
54f4d00
crosspost old items, update with nEventId
AustinKelsay Nov 3, 2023
16f4d5e
Updating noteId encoding, cleaning up a little
AustinKelsay Nov 6, 2023
475a89b
Fixing item-info condition, cleaning up
AustinKelsay Nov 7, 2023
5af11f4
Linting
AustinKelsay Nov 13, 2023
52672e2
Add createdAt variable back
AustinKelsay Nov 13, 2023
6f8f346
Change instances of eventId to noteId
AustinKelsay Nov 20, 2023
aada92c
Adding upsertNoteId mutation
AustinKelsay Nov 20, 2023
f1a3e5d
Cleaning up updateItem, using toasts to communivate success/failure i…
AustinKelsay Nov 22, 2023
54b954c
Linting
AustinKelsay Nov 22, 2023
76750f6
Move crosspost to share button, make sure only OP can crosspost
AustinKelsay Nov 29, 2023
8359688
Lint
AustinKelsay Nov 29, 2023
e03509f
Simplify conditions
AustinKelsay Nov 29, 2023
4437087
user might have no nostr extension installed
AustinKelsay Dec 8, 2023
4c89af5
change upsertNoteId to updateNoteID for resolver and mutations, chang…
AustinKelsay Dec 8, 2023
afee296
Basic setup for crossposting poll / link items
AustinKelsay Nov 14, 2023
44071e1
post rebase fixes and Bounty and job crossposts
AustinKelsay Dec 4, 2023
a47a920
Job crossposting working
AustinKelsay Dec 4, 2023
ac6ca5f
adding back accidentally removed import
AustinKelsay Dec 8, 2023
93d04d2
Lint / rebase
AustinKelsay Dec 31, 2023
1ac2cce
Outsource as much crossposting logic from discussion-form into use-cr…
AustinKelsay Jan 9, 2024
01a24f9
Fix incorrect property for user relays, fix itemId param in updateNoteId
AustinKelsay Jan 9, 2024
9a1fd39
Fix toast messages / error cases in use-crossposter
AustinKelsay Jan 12, 2024
bc214df
Update item forms to for updated use-crossposter hook
AustinKelsay Jan 15, 2024
c486063
CrosspostDropdownItem in share updated to accomodate use-crossposter …
AustinKelsay Jan 17, 2024
ce29a50
Encode paramaterized replacable event id's in naddress format with no…
AustinKelsay Jan 17, 2024
4160b9e
Increase timeout on relay connection / cleaning up
AustinKelsay Jan 19, 2024
34ed45f
No longer crossposting job
AustinKelsay Jan 19, 2024
1c0f78c
Add blastr, fix crosspost button in item-info for polls/discussions, …
AustinKelsay Jan 21, 2024
6e08829
Fix toaster error, create reusable crossposterror function to surface…
AustinKelsay Jan 24, 2024
fc48a85
Cleaning up / comments / linting
AustinKelsay Jan 26, 2024
24c05a3
Update copy
AustinKelsay Jan 30, 2024
0f4f071
Simplify CrosspostdropdownItem, keep replies from being crossposted
AustinKelsay Jan 30, 2024
ee8a58c
Moved query for missing item fields when crossposting to use-crosspos…
AustinKelsay Jan 31, 2024
d2b5913
Remove unneeded param in CrosspostDropdownItem, lint
AustinKelsay Feb 1, 2024
ab05c9f
Small fixes post rebase
AustinKelsay Feb 1, 2024
7cb5329
Remove unused import
AustinKelsay Feb 1, 2024
620b7cc
fix nostr-tools version, fix package-lock.json
AustinKelsay Feb 1, 2024
73357dd
Update components/item-info.js
AustinKelsay Feb 10, 2024
17673ea
Remove unused param, determine poll item type from pollCost field, ad…
AustinKelsay Feb 10, 2024
904188e
Update toaster implementations, use no-cache for item query, restruct…
AustinKelsay Feb 13, 2024
6282502
crosspost info modal that lives under adv-post-form now has dynamic c…
AustinKelsay Feb 13, 2024
a8d265d
Move determineItemType into handleEventCreation, mover item/event han…
AustinKelsay Feb 13, 2024
32f07a3
Lint
AustinKelsay Feb 13, 2024
fa6d6d9
Reconcile skip method with onCancel function in toaster
AustinKelsay Feb 13, 2024
0c71cb2
Handle failedRelays being undefined
AustinKelsay Feb 18, 2024
f92f333
determine item type from router.query.type if available otherwise use…
AustinKelsay Feb 18, 2024
68923eb
Initiliaze failerRelays as undefined but handle error explicitly
AustinKelsay Feb 19, 2024
ae49a42
Lint
AustinKelsay Feb 19, 2024
116edb4
Fix crosspost default value for link, poll, bounty forms
ekzyis Feb 19, 2024
3a01647
Merge branch 'master' into nostr-crossposting-all-item-types
huumn Feb 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions components/use-crossposter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DEFAULT_CROSSPOSTING_RELAYS, crosspost, callWithTimeout } from '../lib/
import { gql, useMutation, useQuery, useLazyQuery } from '@apollo/client'
import { SETTINGS } from '../fragments/users'
import { ITEM_FULL_FIELDS, POLL_FIELDS } from '../fragments/items'
import { re } from 'mathjs'
ekzyis marked this conversation as resolved.
Show resolved Hide resolved

async function discussionToEvent (item) {
const createdAt = Math.floor(Date.now() / 1000)
Expand Down Expand Up @@ -178,7 +179,7 @@ export default function useCrossposter () {
}

const crosspostItem = async item => {
let failedRelays = []
let failedRelays;
let allSuccessful = false
let noteId

Expand All @@ -189,6 +190,11 @@ export default function useCrossposter () {
try {
const result = await crosspost(event, failedRelays || relays)

if (result.error) {
failedRelays = [];
throw new Error(result.error)
}

noteId = result.noteId
failedRelays = result?.failedRelays?.map(relayObj => relayObj.relay) || []

Expand All @@ -206,7 +212,6 @@ export default function useCrossposter () {
}
} catch (error) {
await crosspostError(error.message)
failedRelays = []

// wait 2 seconds to show error then break
await new Promise(resolve => setTimeout(resolve, 2000))
Expand Down
Loading