diff --git a/src/service/request.js b/src/service/request.js index 59a25340..4fc18ebf 100644 --- a/src/service/request.js +++ b/src/service/request.js @@ -202,11 +202,6 @@ export function request(endpoint, options) { status === 404 && endpoint?.startsWith('avatars/') ) { - toast.error(t('message.api_handler.avatar_private_or_deleted')); - avatarStore.avatarDialog.visible = false; - avatarStore.avatarDialog.loading = false; - avatarStore.avatarDialog.id = null; - uiStore.jumpBackDialogCrumb(); $throw(404, data.error?.message || '', endpoint); } if (status === 404 && endpoint.endsWith('/persist/exists')) { diff --git a/src/stores/avatar.js b/src/stores/avatar.js index f1e7eb8b..ca4c5a25 100644 --- a/src/stores/avatar.js +++ b/src/stores/avatar.js @@ -178,12 +178,11 @@ export const useAvatarStore = defineStore('Avatar', () => { * @param {string} avatarId * @returns */ - function showAvatarDialog(avatarId, options = {}) { + function showAvatarDialog(avatarId) { const D = avatarDialog.value; uiStore.openDialog({ type: 'avatar', - id: avatarId, - skipBreadcrumb: options.skipBreadcrumb + id: avatarId }); D.visible = true; if (D.id === avatarId) { @@ -217,17 +216,6 @@ export const useAvatarStore = defineStore('Avatar', () => { if (typeof ref2 !== 'undefined') { D.ref = ref2; uiStore.setDialogCrumbLabel('avatar', D.id, D.ref?.name || D.id); - if ( - ref2.releaseStatus !== 'public' && - ref2.authorId !== userStore.currentUser.id - ) { - D.loading = false; - D.id = null; - D.visible = false; - uiStore.jumpBackDialogCrumb(); - toast.error(t('message.api_handler.avatar_private_or_deleted')); - throw new Error('Avatar is private or deleted'); - } } avatarRequest .getAvatar({ avatarId }) @@ -266,7 +254,7 @@ export const useAvatarStore = defineStore('Avatar', () => { } }) .catch((err) => { - D.visible = false; + D.loading = false; D.id = null; D.visible = false; uiStore.jumpBackDialogCrumb(); diff --git a/src/stores/group.js b/src/stores/group.js index 87b6c68b..cf047164 100644 --- a/src/stores/group.js +++ b/src/stores/group.js @@ -131,14 +131,13 @@ export const useGroupStore = defineStore('Group', () => { { flush: 'sync' } ); - function showGroupDialog(groupId, options = {}) { + function showGroupDialog(groupId) { if (!groupId) { return; } uiStore.openDialog({ type: 'group', - id: groupId, - skipBreadcrumb: options.skipBreadcrumb + id: groupId }); const D = groupDialog.value; D.visible = true; diff --git a/src/stores/instance.js b/src/stores/instance.js index a1892224..2eff72ec 100644 --- a/src/stores/instance.js +++ b/src/stores/instance.js @@ -285,7 +285,7 @@ export const useInstanceStore = defineStore('Instance', () => { return `${baseLabel} ยท ${accessTypeLabel}`; } - function showPreviousInstancesInfoDialog(instanceId, options = {}) { + function showPreviousInstancesInfoDialog(instanceId) { previousInstancesInfoDialog.value.visible = true; previousInstancesInfoDialog.value.instanceId = instanceId; uiStore.openDialog({ @@ -293,8 +293,7 @@ export const useInstanceStore = defineStore('Instance', () => { id: instanceId || '', label: instanceId ? formatPreviousInstancesInfoLabel(instanceId) - : '', - skipBreadcrumb: options.skipBreadcrumb + : '' }); if (instanceId) { const location = parseLocation(instanceId); @@ -319,11 +318,7 @@ export const useInstanceStore = defineStore('Instance', () => { } } - async function showPreviousInstancesListDialog( - variant, - targetRef, - options = {} - ) { + async function showPreviousInstancesListDialog(variant, targetRef) { previousInstancesListDialog.value.variant = variant; let resolved = null; if (variant === 'user') { @@ -346,8 +341,7 @@ export const useInstanceStore = defineStore('Instance', () => { uiStore.openDialog({ type: `previous-instances-${variant}`, id: dialogId, - label, - skipBreadcrumb: options.skipBreadcrumb + label }); } diff --git a/src/stores/ui.js b/src/stores/ui.js index cd8bf579..ca5da20e 100644 --- a/src/stores/ui.js +++ b/src/stores/ui.js @@ -114,8 +114,8 @@ export const useUiStore = defineStore('Ui', () => { } function jumpBackDialogCrumb() { - if (dialogCrumbs.value.length > 1) { - dialogCrumbs.value.splice(dialogCrumbs.value.length - 1); + if (dialogCrumbs.value.length > 0) { + dialogCrumbs.value.pop(); } if (dialogCrumbs.value.length === 0) { closeMainDialog(); @@ -131,45 +131,35 @@ export const useUiStore = defineStore('Ui', () => { } jumpDialogCrumb(index); if (item.type === 'user') { - userStore.showUserDialog(item.id, { skipBreadcrumb: true }); + userStore.showUserDialog(item.id); return; } if (item.type === 'world') { - worldStore.showWorldDialog(item.id, null, { - skipBreadcrumb: true - }); + worldStore.showWorldDialog(item.id, null); return; } if (item.type === 'avatar') { - avatarStore.showAvatarDialog(item.id, { skipBreadcrumb: true }); + avatarStore.showAvatarDialog(item.id); return; } if (item.type === 'group') { - groupStore.showGroupDialog(item.id, { skipBreadcrumb: true }); + groupStore.showGroupDialog(item.id); return; } if (item.type === 'previous-instances-user') { - instanceStore.showPreviousInstancesListDialog('user', item.id, { - skipBreadcrumb: true - }); + instanceStore.showPreviousInstancesListDialog('user', item.id); return; } if (item.type === 'previous-instances-world') { - instanceStore.showPreviousInstancesListDialog('world', item.id, { - skipBreadcrumb: true - }); + instanceStore.showPreviousInstancesListDialog('world', item.id); return; } if (item.type === 'previous-instances-group') { - instanceStore.showPreviousInstancesListDialog('group', item.id, { - skipBreadcrumb: true - }); + instanceStore.showPreviousInstancesListDialog('group', item.id); return; } if (item.type === 'previous-instances-info') { - instanceStore.showPreviousInstancesInfoDialog(item.id, { - skipBreadcrumb: true - }); + instanceStore.showPreviousInstancesInfoDialog(item.id); return; } console.error( @@ -197,7 +187,7 @@ export const useUiStore = defineStore('Ui', () => { clearDialogCrumbs(); } - function openDialog({ type, id, label = '', skipBreadcrumb = false }) { + function openDialog({ type, id, label = '' }) { const userStore = useUserStore(); const worldStore = useWorldStore(); const avatarStore = useAvatarStore(); @@ -239,9 +229,7 @@ export const useUiStore = defineStore('Ui', () => { if (!hadActiveDialog) { clearDialogCrumbs(); } - if (!skipBreadcrumb) { - pushDialogCrumb(type, id, label); - } + pushDialogCrumb(type, id, label); } // Make sure file drops outside of the screenshot manager don't navigate to the file path dropped. diff --git a/src/stores/user.js b/src/stores/user.js index 24c40f5a..3c0e6df0 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -763,7 +763,7 @@ export const useUserStore = defineStore('User', () => { * * @param {string} userId */ - function showUserDialog(userId, options = {}) { + function showUserDialog(userId) { if ( !userId || typeof userId !== 'string' || @@ -773,8 +773,7 @@ export const useUserStore = defineStore('User', () => { } uiStore.openDialog({ type: 'user', - id: userId, - skipBreadcrumb: options.skipBreadcrumb + id: userId }); const D = userDialog.value; D.visible = true; diff --git a/src/stores/world.js b/src/stores/world.js index 0dc22433..e91befe2 100644 --- a/src/stores/world.js +++ b/src/stores/world.js @@ -78,7 +78,7 @@ export const useWorldStore = defineStore('World', () => { * @param {string} tag * @param {string} shortName */ - function showWorldDialog(tag, shortName = null, options = {}) { + function showWorldDialog(tag, shortName = null) { const D = worldDialog; const L = parseLocation(tag); if (L.worldId === '') { @@ -86,8 +86,7 @@ export const useWorldStore = defineStore('World', () => { } uiStore.openDialog({ type: 'world', - id: L.worldId, - skipBreadcrumb: options.skipBreadcrumb + id: L.worldId }); D.visible = true; if (D.id === L.worldId) {