Skip to content

Commit

Permalink
fix: after posting
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui committed Feb 18, 2024
1 parent cc3393c commit 3e36219
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Services from '#services'
import { encodeByNetwork } from '@masknet/encryption'
import { PluginID, Sniffings, SOCIAL_MEDIA_NAME } from '@masknet/shared-base'
import { PluginID, PostIdentifier, Sniffings, SOCIAL_MEDIA_NAME } from '@masknet/shared-base'
import type { Meta } from '@masknet/typed-message'
import { Telemetry } from '@masknet/web3-telemetry'
import { EventID, EventType } from '@masknet/web3-telemetry/types'
Expand Down Expand Up @@ -58,7 +58,17 @@ export function useSubmit(onClose: () => void, reason: 'timeline' | 'popup' | 'r
reason,
},
)
if (postId) location.reload()
const postIdentifier =
lastRecognizedIdentity.identifier && postId ?
new PostIdentifier(lastRecognizedIdentity.identifier, postId)
: undefined

if (postIdentifier) {
const postUrl = activatedSiteAdaptorUI.utils.getPostURL?.(postIdentifier)
if (postUrl) location.assign(postUrl)
} else if (postId) {
location.reload()
}
} else {
if (encode === 'image') {
if (!mediaObject) throw new Error('Failed to create image payload.')
Expand Down

0 comments on commit 3e36219

Please sign in to comment.