This commit is contained in:
syuilo 2024-08-23 12:57:16 +09:00
parent 9e52a3f082
commit b9f76b85c0
2 changed files with 20 additions and 1 deletions

View File

@ -42,7 +42,7 @@ import { computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkImgWithBlurhash from '../MkImgWithBlurhash.vue';
import EmA from './EmA.vue';
import { userPage } from '@/filters/user.js';
import { userPage } from '@/utils.js';
import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue';
const props = withDefaults(defineProps<{

View File

@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as Misskey from 'misskey-js';
import { url } from '@/config.js';
export const acct = (user: Misskey.Acct) => {
return Misskey.acct.toString(user);
};
export const userName = (user: Misskey.entities.User) => {
return user.name || user.username;
};
export const userPage = (user: Misskey.Acct, path?: string, absolute = false) => {
return `${absolute ? url : ''}/@${acct(user)}${(path ? `/${path}` : '')}`;
};