diff --git a/package.json b/package.json index 16f3355..0093344 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "primal-web-app", - "version": "0.77.18", + "version": "0.77.19", "description": "", "scripts": { "start": "vite", diff --git a/src/contexts/AccountContext.tsx b/src/contexts/AccountContext.tsx index b09aa0b..90de83f 100644 --- a/src/contexts/AccountContext.tsx +++ b/src/contexts/AccountContext.tsx @@ -61,7 +61,7 @@ export type AccountContextStore = { removeFollow: (pubkey: string) => void, quoteNote: (noteId: string | undefined) => void, addToMuteList: (pubkey: string) => void, - removeFromMuteList: (pubkey: string) => void, + removeFromMuteList: (pubkey: string, then?: () => void) => void, addRelay: (url: string) => void, removeRelay: (url: string) => void, setConnectToPrimaryRelays: (flag: boolean) => void, @@ -536,12 +536,13 @@ export function AccountProvider(props: { children: number | boolean | Node | JSX const date = Math.floor((new Date()).getTime() / 1000); const muted = [...store.muted, pubkey]; - const { success } = await sendMuteList(muted, date, content?.content || '', store.relays, store.relaySettings); + const { success, note } = await sendMuteList(muted, date, content?.content || '', store.relays, store.relaySettings); if (success) { updateStore('muted', () => muted); updateStore('mutedSince', () => date); saveMuted(store.publicKey, muted, date); + note && triggerImportEvents([note], `import_mutelists_event_add_${APP_ID}`); } } @@ -561,7 +562,7 @@ export function AccountProvider(props: { children: number | boolean | Node | JSX getProfileMuteList(store.publicKey, `before_mute_${APP_ID}`); }; - const removeFromMuteList = (pubkey: string) => { + const removeFromMuteList = (pubkey: string, then?: () => void) => { if (!store.publicKey || !store.muted || !store.muted.includes(pubkey)) { return; } @@ -573,15 +574,17 @@ export function AccountProvider(props: { children: number | boolean | Node | JSX const date = Math.floor((new Date()).getTime() / 1000); const muted = store.muted.filter(m => m !== pubkey); - const { success } = await sendMuteList(muted, date, content?.content || '', store.relays, store.relaySettings); + const { success, note } = await sendMuteList(muted, date, content?.content || '', store.relays, store.relaySettings); if (success) { updateStore('muted', () => muted); updateStore('mutedSince', () => date); saveMuted(store.publicKey, muted, date); + note && triggerImportEvents([note], `import_mute_list_remove_${APP_ID}`); } } + then && then(); unsub(); return; } diff --git a/src/contexts/ProfileContext.tsx b/src/contexts/ProfileContext.tsx index ac2eb05..c9fa44e 100644 --- a/src/contexts/ProfileContext.tsx +++ b/src/contexts/ProfileContext.tsx @@ -129,7 +129,6 @@ export const ProfileProvider = (props: { children: ContextChildren }) => { const saveNotes = (newNotes: PrimalNote[], scope?: 'future') => { if (scope) { - console.log('SAVED NEW NOTES ', newNotes); updateStore(scope, 'notes', (notes) => [ ...notes, ...newNotes ]); loadFutureContent(); return; @@ -226,7 +225,6 @@ export const ProfileProvider = (props: { children: ContextChildren }) => { if (store.future.notes.length === 0) { return; } - console.log('loadFutureContent', store.future.notes); updateStore('notes', (notes) => [...store.future.notes, ...notes]); clearFuture(); diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 5ce8e66..3cc86e7 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -192,17 +192,17 @@ const Profile: Component = () => { return account?.publicKey === profile?.profileKey; }; - createEffect(() => { - const pk = getHex(); + // createEffect(() => { + // const pk = getHex(); - if (!pk) { - return; - } + // if (!pk) { + // return; + // } - if (!isMuted(pk) && account?.isKeyLookupDone) { - profile?.actions.fetchNotes(pk); - } - }); + // if (!isMuted(pk) && account?.isKeyLookupDone) { + // profile?.actions.fetchNotes(pk); + // } + // }); createEffect(() => { const pk = getHex(); @@ -233,7 +233,7 @@ const Profile: Component = () => { return; } - account.actions.removeFromMuteList(profile.profileKey); + account.actions.removeFromMuteList(profile.profileKey, () => setProfile(profile.profileKey)); }; const isFollowingMute = (pk: string | undefined) => { @@ -667,7 +667,9 @@ const Profile: Component = () => { )} - + { + profile?.actions.fetchNextPage(); + }}/>