show "account moved" banner even if the URI couldn't be resolved
This commit is contained in:
parent
b3e41b74a1
commit
800b780267
3 changed files with 17 additions and 6 deletions
|
|
@ -33,6 +33,7 @@ export const Default = {
|
|||
},
|
||||
args: {
|
||||
movedTo: userDetailed().id,
|
||||
movedToUri: 'https://example.com',
|
||||
},
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
|
|
|
|||
|
|
@ -7,25 +7,35 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div v-if="user" :class="$style.root">
|
||||
<i class="ti ti-plane-departure" style="margin-right: 8px;"></i>
|
||||
{{ i18n.ts.accountMoved }}
|
||||
<MkMention :class="$style.link" :username="user.username" :host="user.host ?? localHost"/>
|
||||
<MkMention v-if="user" :class="$style.link" :username="user.username" :host="user.host ?? localHost"/>
|
||||
<MkLink v-else :url="movedToUri"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import MkMention from './MkMention.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { host as localHost } from '@@/js/config.js';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
import MkLink from '@/components/MkLink.vue';
|
||||
|
||||
const user = ref<Misskey.entities.UserLite>();
|
||||
const user = ref<Misskey.entities.UserLite | null>();
|
||||
|
||||
const props = defineProps<{
|
||||
movedTo: string; // user id
|
||||
movedTo?: string | null; // user id
|
||||
movedToUri: string; // user URI
|
||||
}>();
|
||||
|
||||
misskeyApi('users/show', { userId: props.movedTo }).then(u => user.value = u);
|
||||
watch(() => props.movedTo, () => {
|
||||
user.value = null;
|
||||
if (props.movedTo) {
|
||||
misskeyApi('users/show', { userId: props.movedTo }).then(u => user.value = u);
|
||||
}
|
||||
}, {
|
||||
immediate: true,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkInfo v-if="user.isSilenced" :warn="true">{{ i18n.ts.userSilenced }}</MkInfo>
|
||||
|
||||
<div class="profile _gaps">
|
||||
<MkAccountMoved v-if="user.movedTo" :movedTo="user.movedTo"/>
|
||||
<MkAccountMoved v-if="user.movedToUri" :movedTo="user.movedTo" :movedToUri="user.movedToUri"/>
|
||||
<MkRemoteCaution v-if="user.host != null" :href="user.url ?? user.uri!"/>
|
||||
<MkInfo v-if="user.host == null && user.username.includes('.')">{{ i18n.ts.isSystemAccount }}</MkInfo>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue