update
This commit is contained in:
parent
5e140a7ff5
commit
509181a6d0
|
@ -436,6 +436,10 @@ export interface Locale extends ILocale {
|
||||||
* フォロワー
|
* フォロワー
|
||||||
*/
|
*/
|
||||||
"followers": string;
|
"followers": string;
|
||||||
|
/**
|
||||||
|
* プリズム
|
||||||
|
*/
|
||||||
|
"points": string;
|
||||||
/**
|
/**
|
||||||
* フォローされています
|
* フォローされています
|
||||||
*/
|
*/
|
||||||
|
@ -9291,6 +9295,10 @@ export interface Locale extends ILocale {
|
||||||
* 実績を獲得
|
* 実績を獲得
|
||||||
*/
|
*/
|
||||||
"achievementEarned": string;
|
"achievementEarned": string;
|
||||||
|
/**
|
||||||
|
* ログインボーナス
|
||||||
|
*/
|
||||||
|
"loginbonus": string;
|
||||||
/**
|
/**
|
||||||
* 通知テスト
|
* 通知テスト
|
||||||
*/
|
*/
|
||||||
|
@ -9380,6 +9388,10 @@ export interface Locale extends ILocale {
|
||||||
* 実績の獲得
|
* 実績の獲得
|
||||||
*/
|
*/
|
||||||
"achievementEarned": string;
|
"achievementEarned": string;
|
||||||
|
/**
|
||||||
|
* ログインボーナス
|
||||||
|
*/
|
||||||
|
"loginbonus": string;
|
||||||
/**
|
/**
|
||||||
* 連携アプリからの通知
|
* 連携アプリからの通知
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -105,6 +105,7 @@ note: "ノート"
|
||||||
notes: "ノート"
|
notes: "ノート"
|
||||||
following: "フォロー"
|
following: "フォロー"
|
||||||
followers: "フォロワー"
|
followers: "フォロワー"
|
||||||
|
points: "プリズム"
|
||||||
followsYou: "フォローされています"
|
followsYou: "フォローされています"
|
||||||
createList: "リスト作成"
|
createList: "リスト作成"
|
||||||
manageLists: "リストの管理"
|
manageLists: "リストの管理"
|
||||||
|
@ -2452,6 +2453,7 @@ _notification:
|
||||||
roleAssigned: "ロールが付与されました"
|
roleAssigned: "ロールが付与されました"
|
||||||
emptyPushNotificationMessage: "プッシュ通知の更新をしました"
|
emptyPushNotificationMessage: "プッシュ通知の更新をしました"
|
||||||
achievementEarned: "実績を獲得"
|
achievementEarned: "実績を獲得"
|
||||||
|
loginbonus: "ログインボーナス"
|
||||||
testNotification: "通知テスト"
|
testNotification: "通知テスト"
|
||||||
checkNotificationBehavior: "通知の表示を確かめる"
|
checkNotificationBehavior: "通知の表示を確かめる"
|
||||||
sendTestNotification: "テスト通知を送信する"
|
sendTestNotification: "テスト通知を送信する"
|
||||||
|
@ -2476,6 +2478,7 @@ _notification:
|
||||||
followRequestAccepted: "フォローが受理された"
|
followRequestAccepted: "フォローが受理された"
|
||||||
roleAssigned: "ロールが付与された"
|
roleAssigned: "ロールが付与された"
|
||||||
achievementEarned: "実績の獲得"
|
achievementEarned: "実績の獲得"
|
||||||
|
loginbonus: "ログインボーナス"
|
||||||
app: "連携アプリからの通知"
|
app: "連携アプリからの通知"
|
||||||
|
|
||||||
_actions:
|
_actions:
|
||||||
|
|
|
@ -163,6 +163,9 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
...(notification.type === 'achievementEarned' ? {
|
...(notification.type === 'achievementEarned' ? {
|
||||||
achievement: notification.achievement,
|
achievement: notification.achievement,
|
||||||
} : {}),
|
} : {}),
|
||||||
|
...(notification.type === 'loginbonus' ? {
|
||||||
|
loginbonus: notification.loginbonus,
|
||||||
|
} : {}),
|
||||||
...(notification.type === 'app' ? {
|
...(notification.type === 'app' ? {
|
||||||
body: notification.customBody,
|
body: notification.customBody,
|
||||||
header: notification.customHeader,
|
header: notification.customHeader,
|
||||||
|
|
|
@ -404,6 +404,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
userRelations?: Map<MiUser['id'], UserRelation>,
|
userRelations?: Map<MiUser['id'], UserRelation>,
|
||||||
userMemos?: Map<MiUser['id'], string | null>,
|
userMemos?: Map<MiUser['id'], string | null>,
|
||||||
pinNotes?: Map<MiUser['id'], MiUserNotePining[]>,
|
pinNotes?: Map<MiUser['id'], MiUserNotePining[]>,
|
||||||
|
todayGetPoints?: number,
|
||||||
},
|
},
|
||||||
): Promise<Packed<S>> {
|
): Promise<Packed<S>> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
|
@ -507,7 +508,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
iconUrl: r.iconUrl,
|
iconUrl: r.iconUrl,
|
||||||
displayOrder: r.displayOrder,
|
displayOrder: r.displayOrder,
|
||||||
}))) : undefined,
|
}))) : undefined,
|
||||||
|
...(user.host == null ? { getPoints: profile!.getPoints } : {}),
|
||||||
...(isDetailed ? {
|
...(isDetailed ? {
|
||||||
url: profile!.url,
|
url: profile!.url,
|
||||||
uri: user.uri,
|
uri: user.uri,
|
||||||
|
@ -602,6 +603,9 @@ export class UserEntityService implements OnModuleInit {
|
||||||
achievements: profile!.achievements,
|
achievements: profile!.achievements,
|
||||||
loggedInDays: profile!.loggedInDates.length,
|
loggedInDays: profile!.loggedInDates.length,
|
||||||
policies: this.roleService.getUserPolicies(user.id),
|
policies: this.roleService.getUserPolicies(user.id),
|
||||||
|
...(opts.todayGetPoints ? {
|
||||||
|
todayGetPoints: opts.todayGetPoints,
|
||||||
|
} : {}),
|
||||||
} : {}),
|
} : {}),
|
||||||
|
|
||||||
...(opts.includeSecrets ? {
|
...(opts.includeSecrets ? {
|
||||||
|
|
|
@ -261,6 +261,10 @@ export class MiUserProfile {
|
||||||
length: 32, array: true, default: '{}',
|
length: 32, array: true, default: '{}',
|
||||||
})
|
})
|
||||||
public loggedInDates: string[];
|
public loggedInDates: string[];
|
||||||
|
@Column('integer', {
|
||||||
|
default: '0',
|
||||||
|
})
|
||||||
|
public getPoints: number;
|
||||||
|
|
||||||
@Column('jsonb', {
|
@Column('jsonb', {
|
||||||
default: [],
|
default: [],
|
||||||
|
|
|
@ -8,13 +8,14 @@ import type { UserProfilesRepository } from '@/models/_.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { NotificationService } from '@/core/NotificationService.js';
|
||||||
import { ApiError } from '../error.js';
|
import { ApiError } from '../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['account'],
|
tags: ['account'],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
kind: "read:account",
|
kind: 'read:account',
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -43,7 +44,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.userProfilesRepository)
|
@Inject(DI.userProfilesRepository)
|
||||||
private userProfilesRepository: UserProfilesRepository,
|
private userProfilesRepository: UserProfilesRepository,
|
||||||
|
private notificationService: NotificationService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, user, token) => {
|
super(meta, paramDef, async (ps, user, token) => {
|
||||||
|
@ -51,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const today = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
|
const today = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
|
||||||
|
let todayGetPoints = 0;
|
||||||
// 渡ってきている user はキャッシュされていて古い可能性があるので改めて取得
|
// 渡ってきている user はキャッシュされていて古い可能性があるので改めて取得
|
||||||
const userProfile = await this.userProfilesRepository.findOne({
|
const userProfile = await this.userProfilesRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
@ -65,9 +66,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userProfile.loggedInDates.includes(today)) {
|
if (!userProfile.loggedInDates.includes(today)) {
|
||||||
|
todayGetPoints = Math.floor(Math.random() * 5) + 1;
|
||||||
this.userProfilesRepository.update({ userId: user.id }, {
|
this.userProfilesRepository.update({ userId: user.id }, {
|
||||||
loggedInDates: [...userProfile.loggedInDates, today],
|
loggedInDates: [...userProfile.loggedInDates, today],
|
||||||
});
|
});
|
||||||
|
this.userProfilesRepository.update({ userId: user.id }, {
|
||||||
|
getPoints: userProfile.getPoints + todayGetPoints,
|
||||||
|
});
|
||||||
|
this.notificationService.createNotification(user.id, 'loginbonus', {
|
||||||
|
loginbonus: todayGetPoints,
|
||||||
|
});
|
||||||
userProfile.loggedInDates = [...userProfile.loggedInDates, today];
|
userProfile.loggedInDates = [...userProfile.loggedInDates, today];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
schema: 'MeDetailed',
|
schema: 'MeDetailed',
|
||||||
includeSecrets: isSecure,
|
includeSecrets: isSecure,
|
||||||
userProfile,
|
userProfile,
|
||||||
|
...(todayGetPoints && { todayGetPoints }),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ export const notificationTypes = [
|
||||||
'achievementEarned',
|
'achievementEarned',
|
||||||
'app',
|
'app',
|
||||||
'test',
|
'test',
|
||||||
|
'loginbonus',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const groupedNotificationTypes = [
|
export const groupedNotificationTypes = [
|
||||||
|
|
|
@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div :class="$style.root">
|
<div :class="$style.root">
|
||||||
<div :class="$style.head">
|
<div :class="$style.head">
|
||||||
<MkAvatar v-if="['pollEnded', 'note'].includes(notification.type) && notification.note" :class="$style.icon" :user="notification.note.user" link preview/>
|
<MkAvatar v-if="['pollEnded', 'note'].includes(notification.type) && notification.note" :class="$style.icon" :user="notification.note.user" link preview/>
|
||||||
<MkAvatar v-else-if="['roleAssigned', 'achievementEarned'].includes(notification.type)" :class="$style.icon" :user="$i" link preview/>
|
<MkAvatar v-else-if="['roleAssigned', 'achievementEarned', 'loginbonus'].includes(notification.type)" :class="$style.icon" :user="$i" link preview/>
|
||||||
<div v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'" :class="[$style.icon, $style.icon_reactionGroupHeart]"><i class="ti ti-heart" style="line-height: 1;"></i></div>
|
<div v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'" :class="[$style.icon, $style.icon_reactionGroupHeart]"><i class="ti ti-heart" style="line-height: 1;"></i></div>
|
||||||
<div v-else-if="notification.type === 'reaction:grouped'" :class="[$style.icon, $style.icon_reactionGroup]"><i class="ti ti-plus" style="line-height: 1;"></i></div>
|
<div v-else-if="notification.type === 'reaction:grouped'" :class="[$style.icon, $style.icon_reactionGroup]"><i class="ti ti-plus" style="line-height: 1;"></i></div>
|
||||||
<div v-else-if="notification.type === 'renote:grouped'" :class="[$style.icon, $style.icon_renoteGroup]"><i class="ti ti-repeat" style="line-height: 1;"></i></div>
|
<div v-else-if="notification.type === 'renote:grouped'" :class="[$style.icon, $style.icon_renoteGroup]"><i class="ti ti-repeat" style="line-height: 1;"></i></div>
|
||||||
|
@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
[$style.t_quote]: notification.type === 'quote',
|
[$style.t_quote]: notification.type === 'quote',
|
||||||
[$style.t_pollEnded]: notification.type === 'pollEnded',
|
[$style.t_pollEnded]: notification.type === 'pollEnded',
|
||||||
[$style.t_achievementEarned]: notification.type === 'achievementEarned',
|
[$style.t_achievementEarned]: notification.type === 'achievementEarned',
|
||||||
|
[$style.t_achievementEarned]: notification.type === 'loginbonus',
|
||||||
[$style.t_roleAssigned]: notification.type === 'roleAssigned' && notification.role.iconUrl == null,
|
[$style.t_roleAssigned]: notification.type === 'roleAssigned' && notification.role.iconUrl == null,
|
||||||
}]"
|
}]"
|
||||||
>
|
>
|
||||||
|
@ -37,6 +38,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<i v-else-if="notification.type === 'quote'" class="ti ti-quote"></i>
|
<i v-else-if="notification.type === 'quote'" class="ti ti-quote"></i>
|
||||||
<i v-else-if="notification.type === 'pollEnded'" class="ti ti-chart-arrows"></i>
|
<i v-else-if="notification.type === 'pollEnded'" class="ti ti-chart-arrows"></i>
|
||||||
<i v-else-if="notification.type === 'achievementEarned'" class="ti ti-medal"></i>
|
<i v-else-if="notification.type === 'achievementEarned'" class="ti ti-medal"></i>
|
||||||
|
<i v-else-if="notification.type === 'loginbonus'" class="ti ti-medal"></i>
|
||||||
|
|
||||||
<template v-else-if="notification.type === 'roleAssigned'">
|
<template v-else-if="notification.type === 'roleAssigned'">
|
||||||
<img v-if="notification.role.iconUrl" style="height: 1.3em; vertical-align: -22%;" :src="notification.role.iconUrl" alt=""/>
|
<img v-if="notification.role.iconUrl" style="height: 1.3em; vertical-align: -22%;" :src="notification.role.iconUrl" alt=""/>
|
||||||
<i v-else class="ti ti-badges"></i>
|
<i v-else class="ti ti-badges"></i>
|
||||||
|
@ -56,6 +59,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<span v-else-if="notification.type === 'note'">{{ i18n.ts._notification.newNote }}: <MkUserName :user="notification.note.user"/></span>
|
<span v-else-if="notification.type === 'note'">{{ i18n.ts._notification.newNote }}: <MkUserName :user="notification.note.user"/></span>
|
||||||
<span v-else-if="notification.type === 'roleAssigned'">{{ i18n.ts._notification.roleAssigned }}</span>
|
<span v-else-if="notification.type === 'roleAssigned'">{{ i18n.ts._notification.roleAssigned }}</span>
|
||||||
<span v-else-if="notification.type === 'achievementEarned'">{{ i18n.ts._notification.achievementEarned }}</span>
|
<span v-else-if="notification.type === 'achievementEarned'">{{ i18n.ts._notification.achievementEarned }}</span>
|
||||||
|
<span v-else-if="notification.type === 'loginbonus'">{{ i18n.ts._notification.loginbonus }}</span>
|
||||||
<span v-else-if="notification.type === 'test'">{{ i18n.ts._notification.testNotification }}</span>
|
<span v-else-if="notification.type === 'test'">{{ i18n.ts._notification.testNotification }}</span>
|
||||||
<MkA v-else-if="notification.type === 'follow' || notification.type === 'mention' || notification.type === 'reply' || notification.type === 'renote' || notification.type === 'quote' || notification.type === 'reaction' || notification.type === 'receiveFollowRequest' || notification.type === 'followRequestAccepted'" v-user-preview="notification.user.id" :class="$style.headerName" :to="userPage(notification.user)"><MkUserName :user="notification.user"/></MkA>
|
<MkA v-else-if="notification.type === 'follow' || notification.type === 'mention' || notification.type === 'reply' || notification.type === 'renote' || notification.type === 'quote' || notification.type === 'reaction' || notification.type === 'receiveFollowRequest' || notification.type === 'followRequestAccepted'" v-user-preview="notification.user.id" :class="$style.headerName" :to="userPage(notification.user)"><MkUserName :user="notification.user"/></MkA>
|
||||||
<span v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'">{{ i18n.tsx._notification.likedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }}</span>
|
<span v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'">{{ i18n.tsx._notification.likedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }}</span>
|
||||||
|
@ -94,10 +98,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkA>
|
</MkA>
|
||||||
<div v-else-if="notification.type === 'roleAssigned'" :class="$style.text">
|
<div v-else-if="notification.type === 'roleAssigned'" :class="$style.text">
|
||||||
{{ notification.role.name }}
|
{{ notification.role.name }}
|
||||||
|
</div> <div v-else-if="notification.type === 'loginbonus'" :class="$style.text">
|
||||||
|
{{ notification.loginbonus }}プリズム入手しました!
|
||||||
</div>
|
</div>
|
||||||
<MkA v-else-if="notification.type === 'achievementEarned'" :class="$style.text" to="/my/achievements">
|
<MkA v-else-if="notification.type === 'achievementEarned'" :class="$style.text" to="/my/achievements">
|
||||||
{{ i18n.ts._achievements._types['_' + notification.achievement].title }}
|
{{ i18n.ts._achievements._types['_' + notification.achievement].title }}
|
||||||
</MkA>
|
</MkA>
|
||||||
|
|
||||||
<template v-else-if="notification.type === 'follow'">
|
<template v-else-if="notification.type === 'follow'">
|
||||||
<span :class="$style.text" style="opacity: 0.6;">{{ i18n.ts.youGotNewFollower }}</span>
|
<span :class="$style.text" style="opacity: 0.6;">{{ i18n.ts.youGotNewFollower }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -24,7 +24,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<span class="username"><MkAcct :user="user" :detail="true"/></span>
|
<span class="username"><MkAcct :user="user" :detail="true"/></span>
|
||||||
<span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i
|
<span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i
|
||||||
class="ti ti-shield"></i></span>
|
class="ti ti-shield"
|
||||||
|
></i></span>
|
||||||
<span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span>
|
<span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span>
|
||||||
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
|
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
|
||||||
<button v-if="$i && !isEditingMemo && !memoDraft" class="_button add-note-button" @click="showMemoTextarea">
|
<button v-if="$i && !isEditingMemo && !memoDraft" class="_button add-note-button" @click="showMemoTextarea">
|
||||||
|
@ -36,8 +37,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="$i" class="actions">
|
<div v-if="$i" class="actions">
|
||||||
<button class="menu _button" @click="menu"><i class="ti ti-dots"></i></button>
|
<button class="menu _button" @click="menu"><i class="ti ti-dots"></i></button>
|
||||||
<MkNotifyButton v-if="$i.id != user.id " :user="user"></MkNotifyButton>
|
<MkNotifyButton v-if="$i.id != user.id " :user="user"></MkNotifyButton>
|
||||||
<MkFollowButton v-if="$i.id != user.id" v-model:user="user" :inline="true" :transparent="false" :full="true"
|
<MkFollowButton
|
||||||
class="koudoku"/>
|
v-if="$i.id != user.id" v-model:user="user" :inline="true" :transparent="false" :full="true"
|
||||||
|
class="koudoku"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<MkAvatar class="avatar" :user="user" indicator/>
|
<MkAvatar class="avatar" :user="user" indicator/>
|
||||||
|
@ -46,14 +49,17 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<span class="username"><MkAcct :user="user" :detail="true"/></span>
|
<span class="username"><MkAcct :user="user" :detail="true"/></span>
|
||||||
<span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i
|
<span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i
|
||||||
class="ti ti-shield"></i></span>
|
class="ti ti-shield"
|
||||||
|
></i></span>
|
||||||
<span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span>
|
<span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span>
|
||||||
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
|
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="user.roles.length > 0" class="roles">
|
<div v-if="user.roles.length > 0" class="roles">
|
||||||
<span v-for="role in user.roles" :key="role.id" v-tooltip="role.description" class="role"
|
<span
|
||||||
:style="{ '--color': role.color }">
|
v-for="role in user.roles" :key="role.id" v-tooltip="role.description" class="role"
|
||||||
|
:style="{ '--color': role.color }"
|
||||||
|
>
|
||||||
<MkA v-adaptive-bg :to="`/roles/${role.id}`">
|
<MkA v-adaptive-bg :to="`/roles/${role.id}`">
|
||||||
<img v-if="role.iconUrl" style="height: 1.3em; vertical-align: -22%;" :src="role.iconUrl"/>
|
<img v-if="role.iconUrl" style="height: 1.3em; vertical-align: -22%;" :src="role.iconUrl"/>
|
||||||
{{ role.name }}
|
{{ role.name }}
|
||||||
|
@ -61,8 +67,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="iAmModerator" class="moderationNote">
|
<div v-if="iAmModerator" class="moderationNote">
|
||||||
<MkTextarea v-if="editModerationNote || (moderationNote != null && moderationNote !== '')"
|
<MkTextarea
|
||||||
v-model="moderationNote" manualSave>
|
v-if="editModerationNote || (moderationNote != null && moderationNote !== '')"
|
||||||
|
v-model="moderationNote" manualSave
|
||||||
|
>
|
||||||
<template #label>{{ i18n.ts.moderationNote }}</template>
|
<template #label>{{ i18n.ts.moderationNote }}</template>
|
||||||
</MkTextarea>
|
</MkTextarea>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
|
@ -93,14 +101,16 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</dl>
|
</dl>
|
||||||
<dl v-if="user.birthday" class="field">
|
<dl v-if="user.birthday" class="field">
|
||||||
<dt class="name"><i class="ti ti-cake ti-fw"></i> {{ i18n.ts.birthday }}</dt>
|
<dt class="name"><i class="ti ti-cake ti-fw"></i> {{ i18n.ts.birthday }}</dt>
|
||||||
<dd class="value">{{ user.birthday.replace('-', '/').replace('-', '/') }} ({{
|
<dd class="value">
|
||||||
|
{{ user.birthday.replace('-', '/').replace('-', '/') }} ({{
|
||||||
i18n.tsx.yearsOld({age})
|
i18n.tsx.yearsOld({age})
|
||||||
}})
|
}})
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="field">
|
<dl class="field">
|
||||||
<dt class="name"><i class="ti ti-calendar ti-fw"></i> {{ i18n.ts.registeredDate }}</dt>
|
<dt class="name"><i class="ti ti-calendar ti-fw"></i> {{ i18n.ts.registeredDate }}</dt>
|
||||||
<dd class="value">{{ dateString(user.createdAt) }} (
|
<dd class="value">
|
||||||
|
{{ dateString(user.createdAt) }} (
|
||||||
<MkTime :time="user.createdAt"/>
|
<MkTime :time="user.createdAt"/>
|
||||||
)
|
)
|
||||||
</dd>
|
</dd>
|
||||||
|
@ -113,8 +123,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="value">
|
<dd class="value">
|
||||||
<Mfm :text="field.value" :author="user" :colored="false"/>
|
<Mfm :text="field.value" :author="user" :colored="false"/>
|
||||||
<i v-if="user.verifiedLinks.includes(field.value)" v-tooltip:dialog="i18n.ts.verifiedLink"
|
<i
|
||||||
class="ti ti-circle-check" :class="$style.verifiedLink"></i>
|
v-if="user.verifiedLinks.includes(field.value)" v-tooltip:dialog="i18n.ts.verifiedLink"
|
||||||
|
class="ti ti-circle-check" :class="$style.verifiedLink"
|
||||||
|
></i>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -131,6 +143,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<b>{{ number(user.followersCount) }}</b>
|
<b>{{ number(user.followersCount) }}</b>
|
||||||
<span>{{ i18n.ts.followers }}</span>
|
<span>{{ i18n.ts.followers }}</span>
|
||||||
</MkA>
|
</MkA>
|
||||||
|
<MkA>
|
||||||
|
<b> {{ number(user.getPoints) }}</b>
|
||||||
|
<span>{{ i18n.ts.points }}</span>
|
||||||
|
</MkA>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -159,11 +175,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<XActivity :key="user.id" :user="user"/>
|
<XActivity :key="user.id" :user="user"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {defineAsyncComponent, computed, onMounted, onUnmounted, nextTick, watch, ref } from 'vue';
|
import { defineAsyncComponent, computed, onMounted, onUnmounted, nextTick, watch, ref } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkNote from '@/components/MkNote.vue';
|
import MkNote from '@/components/MkNote.vue';
|
||||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||||
|
@ -173,22 +189,22 @@ import MkTextarea from '@/components/MkTextarea.vue';
|
||||||
import MkOmit from '@/components/MkOmit.vue';
|
import MkOmit from '@/components/MkOmit.vue';
|
||||||
import MkInfo from '@/components/MkInfo.vue';
|
import MkInfo from '@/components/MkInfo.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import {getScrollPosition} from '@/scripts/scroll.js';
|
import { getScrollPosition } from '@/scripts/scroll.js';
|
||||||
import {getUserMenu} from '@/scripts/get-user-menu.js';
|
import { getUserMenu } from '@/scripts/get-user-menu.js';
|
||||||
import number from '@/filters/number.js';
|
import number from '@/filters/number.js';
|
||||||
import {userPage} from '@/filters/user.js';
|
import { userPage } from '@/filters/user.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
import {i18n} from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import {$i, iAmModerator} from '@/account.js';
|
import { $i, iAmModerator } from '@/account.js';
|
||||||
import {dateString} from '@/filters/date.js';
|
import { dateString } from '@/filters/date.js';
|
||||||
import {confetti} from '@/scripts/confetti.js';
|
import { confetti } from '@/scripts/confetti.js';
|
||||||
import {misskeyApi} from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import {isFollowingVisibleForMe, isFollowersVisibleForMe} from '@/scripts/isFfVisibleForMe.js';
|
import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
|
||||||
import MkNotifyButton from "@/components/MkNotifyButton.vue";
|
import MkNotifyButton from '@/components/MkNotifyButton.vue';
|
||||||
import MkRemoteInfoUpdate from "@/components/MkRemoteInfoUpdate.vue";
|
import MkRemoteInfoUpdate from '@/components/MkRemoteInfoUpdate.vue';
|
||||||
import MkNotes from "@/components/MkNotes.vue";
|
import MkNotes from '@/components/MkNotes.vue';
|
||||||
import MkLazy from "@/components/global/MkLazy.vue";
|
import MkLazy from '@/components/global/MkLazy.vue';
|
||||||
|
|
||||||
function calcAge(birthdate: string): number {
|
function calcAge(birthdate: string): number {
|
||||||
const date = new Date(birthdate);
|
const date = new Date(birthdate);
|
||||||
|
@ -231,7 +247,7 @@ const moderationNote = ref(props.user.moderationNote);
|
||||||
const editModerationNote = ref(false);
|
const editModerationNote = ref(false);
|
||||||
|
|
||||||
watch(moderationNote, async () => {
|
watch(moderationNote, async () => {
|
||||||
await misskeyApi('admin/update-user-note', {userId: props.user.id, text: moderationNote.value });
|
await misskeyApi('admin/update-user-note', { userId: props.user.id, text: moderationNote.value });
|
||||||
});
|
});
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
|
@ -241,13 +257,13 @@ const pagination = {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
const Notes ={
|
const Notes = {
|
||||||
endpoint: 'users/notes' as const,
|
endpoint: 'users/notes' as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
})),
|
})),
|
||||||
}
|
};
|
||||||
|
|
||||||
const style = computed(() => {
|
const style = computed(() => {
|
||||||
if (props.user.bannerUrl == null) return {};
|
if (props.user.bannerUrl == null) return {};
|
||||||
|
@ -261,7 +277,7 @@ const age = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function menu(ev: MouseEvent) {
|
function menu(ev: MouseEvent) {
|
||||||
const {menu, cleanup} = getUserMenu(user.value, router);
|
const { menu, cleanup } = getUserMenu(user.value, router);
|
||||||
os.popupMenu(menu, ev.currentTarget ?? ev.target).finally(cleanup);
|
os.popupMenu(menu, ev.currentTarget ?? ev.target).finally(cleanup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue