Merge branch 'develop' into mahjong

This commit is contained in:
syuilo 2024-02-01 16:42:32 +09:00
commit 10a112489d
72 changed files with 214 additions and 201 deletions

View file

@ -0,0 +1,28 @@
name: Check Misskey JS version
on:
push:
branches: [ develop ]
paths:
- packages/misskey-js/package.json
- package.json
pull_request:
branches: [ develop ]
paths:
- packages/misskey-js/package.json
- package.json
jobs:
check-version:
# ルートの package.json と packages/misskey-js/package.json のバージョンが一致しているかを確認する
name: Check version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Check version
run: |
if [ "$(jq -r '.version' package.json)" != "$(jq -r '.version' packages/misskey-js/package.json)" ]; then
echo "Version mismatch!"
exit 1
fi

View file

@ -54,17 +54,3 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/misskey-js/coverage/coverage-final.json
check-version:
# ルートの package.json と packages/misskey-js/package.json のバージョンが一致しているかを確認する
name: Check version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Check version
run: |
if [ "$(jq -r '.version' package.json)" != "$(jq -r '.version' packages/misskey-js/package.json)" ]; then
echo "Version mismatch!"
exit 1
fi

View file

@ -96,7 +96,7 @@ export class AccountMoveService {
await this.apDeliverManagerService.deliverToFollowers(src, moveAct);
// Publish meUpdated event
const iObj = await this.userEntityService.pack<true, true>(src.id, src, { detail: true, includeSecrets: true });
const iObj = await this.userEntityService.pack(src.id, src, { schema: 'MeDetailed', includeSecrets: true });
this.globalEventService.publishMainStream(src.id, 'meUpdated', iObj);
// Unfollow after 24 hours

View file

@ -55,15 +55,15 @@ export interface MainEventTypes {
reply: Packed<'Note'>;
renote: Packed<'Note'>;
follow: Packed<'UserDetailedNotMe'>;
followed: Packed<'UserDetailed' | 'UserLite'>;
unfollow: Packed<'UserDetailed'>;
meUpdated: Packed<'UserDetailed'>;
followed: Packed<'UserLite'>;
unfollow: Packed<'UserDetailedNotMe'>;
meUpdated: Packed<'MeDetailed'>;
pageEvent: {
pageId: MiPage['id'];
event: string;
var: any;
userId: MiUser['id'];
user: Packed<'User'>;
user: Packed<'UserDetailed'>;
};
urlUploadFinished: {
marker?: string | null;
@ -93,7 +93,7 @@ export interface MainEventTypes {
};
driveFileCreated: Packed<'DriveFile'>;
readAntenna: MiAntenna;
receiveFollowRequest: Packed<'User'>;
receiveFollowRequest: Packed<'UserLite'>;
announcementCreated: {
announcement: Packed<'Announcement'>;
};
@ -141,8 +141,8 @@ type NoteStreamEventTypes = {
};
export interface UserListEventTypes {
userAdded: Packed<'User'>;
userRemoved: Packed<'User'>;
userAdded: Packed<'UserLite'>;
userRemoved: Packed<'UserLite'>;
}
export interface AntennaEventTypes {

View file

@ -109,13 +109,13 @@ export class UserBlockingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(followee)) {
this.userEntityService.pack(followee, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
if (this.userEntityService.isLocalUser(follower) && !silent) {
this.userEntityService.pack(followee, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'unfollow', packed);

View file

@ -293,9 +293,9 @@ export class UserFollowingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(follower) && !silent) {
// Publish follow event
this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'follow', packed as Packed<'UserDetailedNotMe'>);
this.globalEventService.publishMainStream(follower.id, 'follow', packed);
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === follower.id && x.on.includes('follow'));
for (const webhook of webhooks) {
@ -360,7 +360,7 @@ export class UserFollowingService implements OnModuleInit {
if (!silent && this.userEntityService.isLocalUser(follower)) {
// Publish unfollow event
this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'unfollow', packed);
@ -500,7 +500,7 @@ export class UserFollowingService implements OnModuleInit {
this.userEntityService.pack(follower.id, followee).then(packed => this.globalEventService.publishMainStream(followee.id, 'receiveFollowRequest', packed));
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
// 通知を作成
@ -548,7 +548,7 @@ export class UserFollowingService implements OnModuleInit {
});
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
@ -576,7 +576,7 @@ export class UserFollowingService implements OnModuleInit {
}
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
@ -696,7 +696,7 @@ export class UserFollowingService implements OnModuleInit {
@bindThis
private async publishUnfollow(followee: Both, follower: Local): Promise<void> {
const packedFollowee = await this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
});
this.globalEventService.publishMainStream(follower.id, 'unfollow', packedFollowee);

View file

@ -38,13 +38,13 @@ export class AbuseUserReportEntityService {
targetUserId: report.targetUserId,
assigneeId: report.assigneeId,
reporter: this.userEntityService.pack(report.reporter ?? report.reporterId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
targetUser: this.userEntityService.pack(report.targetUser ?? report.targetUserId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
assignee: report.assigneeId ? this.userEntityService.pack(report.assignee ?? report.assigneeId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}) : null,
forwarded: report.forwarded,
});

View file

@ -37,7 +37,7 @@ export class BlockingEntityService {
createdAt: this.idService.parse(blocking.id).date.toISOString(),
blockeeId: blocking.blockeeId,
blockee: this.userEntityService.pack(blocking.blockeeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -42,7 +42,7 @@ export class FlashEntityService {
createdAt: this.idService.parse(flash.id).date.toISOString(),
updatedAt: flash.updatedAt.toISOString(),
userId: flash.userId,
user: this.userEntityService.pack(flash.user ?? flash.userId, me), // { detail: true } すると無限ループするので注意
user: this.userEntityService.pack(flash.user ?? flash.userId, me), // { schema: 'UserDetailed' } すると無限ループするので注意
title: flash.title,
summary: flash.summary,
script: flash.script,

View file

@ -89,10 +89,10 @@ export class FollowingEntityService {
followeeId: following.followeeId,
followerId: following.followerId,
followee: opts.populateFollowee ? this.userEntityService.pack(following.followee ?? following.followeeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}) : undefined,
follower: opts.populateFollower ? this.userEntityService.pack(following.follower ?? following.followerId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}) : undefined,
});
}

View file

@ -37,7 +37,7 @@ export class ModerationLogEntityService {
info: log.info,
userId: log.userId,
user: this.userEntityService.pack(log.user ?? log.userId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -39,7 +39,7 @@ export class MutingEntityService {
expiresAt: muting.expiresAt ? muting.expiresAt.toISOString() : null,
muteeId: muting.muteeId,
mutee: this.userEntityService.pack(muting.muteeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -324,9 +324,7 @@ export class NoteEntityService implements OnModuleInit {
id: note.id,
createdAt: this.idService.parse(note.id).date.toISOString(),
userId: note.userId,
user: this.userEntityService.pack(note.user ?? note.userId, me, {
detail: false,
}),
user: this.userEntityService.pack(note.user ?? note.userId, me),
text: text,
cw: note.cw,
visibility: note.visibility,

View file

@ -62,7 +62,7 @@ export class NotificationEntityService implements OnModuleInit {
},
hint?: {
packedNotes: Map<MiNote['id'], Packed<'Note'>>;
packedUsers: Map<MiUser['id'], Packed<'User'>>;
packedUsers: Map<MiUser['id'], Packed<'UserLite'>>;
},
): Promise<Packed<'Notification'>> {
const notification = src;
@ -76,9 +76,7 @@ export class NotificationEntityService implements OnModuleInit {
const userIfNeed = 'notifierId' in notification ? (
hint?.packedUsers != null
? hint.packedUsers.get(notification.notifierId)
: this.userEntityService.pack(notification.notifierId, { id: meId }, {
detail: false,
})
: this.userEntityService.pack(notification.notifierId, { id: meId })
) : undefined;
const role = notification.type === 'roleAssigned' ? await this.roleEntityService.pack(notification.roleId) : undefined;
@ -131,9 +129,7 @@ export class NotificationEntityService implements OnModuleInit {
const users = userIds.length > 0 ? await this.usersRepository.find({
where: { id: In(userIds) },
}) : [];
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId }, {
detail: false,
});
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId });
const packedUsers = new Map(packedUsersArray.map(p => [p.id, p]));
// 既に解決されたフォローリクエストの通知を除外
@ -161,7 +157,7 @@ export class NotificationEntityService implements OnModuleInit {
},
hint?: {
packedNotes: Map<MiNote['id'], Packed<'Note'>>;
packedUsers: Map<MiUser['id'], Packed<'User'>>;
packedUsers: Map<MiUser['id'], Packed<'UserLite'>>;
},
): Promise<Packed<'Notification'>> {
const notification = src;
@ -175,18 +171,14 @@ export class NotificationEntityService implements OnModuleInit {
const userIfNeed = 'notifierId' in notification ? (
hint?.packedUsers != null
? hint.packedUsers.get(notification.notifierId)
: this.userEntityService.pack(notification.notifierId, { id: meId }, {
detail: false,
})
: this.userEntityService.pack(notification.notifierId, { id: meId })
) : undefined;
if (notification.type === 'reaction:grouped') {
const reactions = await Promise.all(notification.reactions.map(async reaction => {
const user = hint?.packedUsers != null
? hint.packedUsers.get(reaction.userId)!
: await this.userEntityService.pack(reaction.userId, { id: meId }, {
detail: false,
});
: await this.userEntityService.pack(reaction.userId, { id: meId });
return {
user,
reaction: reaction.reaction,
@ -206,9 +198,7 @@ export class NotificationEntityService implements OnModuleInit {
return packedUser;
}
return this.userEntityService.pack(userId, { id: meId }, {
detail: false,
});
return this.userEntityService.pack(userId, { id: meId });
}));
return await awaitAll({
id: notification.id,
@ -275,9 +265,7 @@ export class NotificationEntityService implements OnModuleInit {
const users = userIds.length > 0 ? await this.usersRepository.find({
where: { id: In(userIds) },
}) : [];
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId }, {
detail: false,
});
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId });
const packedUsers = new Map(packedUsersArray.map(p => [p.id, p]));
// 既に解決されたフォローリクエストの通知を除外

View file

@ -90,7 +90,7 @@ export class PageEntityService {
createdAt: this.idService.parse(page.id).date.toISOString(),
updatedAt: page.updatedAt.toISOString(),
userId: page.userId,
user: this.userEntityService.pack(page.user ?? page.userId, me), // { detail: true } すると無限ループするので注意
user: this.userEntityService.pack(page.user ?? page.userId, me), // { schema: 'UserDetailed' } すると無限ループするので注意
content: page.content,
variables: page.variables,
title: page.title,

View file

@ -38,7 +38,7 @@ export class RenoteMutingEntityService {
createdAt: this.idService.parse(muting.id).date.toISOString(),
muteeId: muting.muteeId,
mutee: this.userEntityService.pack(muting.muteeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -30,14 +30,6 @@ import type { NoteEntityService } from './NoteEntityService.js';
import type { DriveFileEntityService } from './DriveFileEntityService.js';
import type { PageEntityService } from './PageEntityService.js';
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>;
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
Detailed extends true ?
ExpectsMe extends true ? Packed<'MeDetailed'> :
ExpectsMe extends false ? Packed<'UserDetailedNotMe'> :
Packed<'UserDetailed'> :
Packed<'UserLite'>;
const Ajv = _Ajv.default;
const ajv = new Ajv();
@ -303,33 +295,34 @@ export class UserEntityService implements OnModuleInit {
return `${this.config.url}/users/${userId}`;
}
public async pack<ExpectsMe extends boolean | null = null, D extends boolean = false>(
public async pack<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
src: MiUser['id'] | MiUser,
me?: { id: MiUser['id']; } | null | undefined,
options?: {
detail?: D,
schema?: S,
includeSecrets?: boolean,
userProfile?: MiUserProfile,
},
): Promise<IsMeAndIsUserDetailed<ExpectsMe, D>> {
): Promise<Packed<S>> {
const opts = Object.assign({
detail: false,
schema: 'UserLite',
includeSecrets: false,
}, options);
const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });
const isDetailed = opts.schema !== 'UserLite';
const meId = me ? me.id : null;
const isMe = meId === user.id;
const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false;
const relation = meId && !isMe && opts.detail ? await this.getRelation(meId, user.id) : null;
const pins = opts.detail ? await this.userNotePiningsRepository.createQueryBuilder('pin')
const relation = meId && !isMe && isDetailed ? await this.getRelation(meId, user.id) : null;
const pins = isDetailed ? await this.userNotePiningsRepository.createQueryBuilder('pin')
.where('pin.userId = :userId', { userId: user.id })
.innerJoinAndSelect('pin.note', 'note')
.orderBy('pin.id', 'DESC')
.getMany() : [];
const profile = opts.detail ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null;
const profile = isDetailed ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null;
const followingCount = profile == null ? null :
(profile.followingVisibility === 'public') || isMe ? user.followingCount :
@ -341,15 +334,15 @@ export class UserEntityService implements OnModuleInit {
(profile.followersVisibility === 'followers') && (relation && relation.isFollowing) ? user.followersCount :
null;
const isModerator = isMe && opts.detail ? this.roleService.isModerator(user) : null;
const isAdmin = isMe && opts.detail ? this.roleService.isAdministrator(user) : null;
const unreadAnnouncements = isMe && opts.detail ?
const isModerator = isMe && isDetailed ? this.roleService.isModerator(user) : null;
const isAdmin = isMe && isDetailed ? this.roleService.isAdministrator(user) : null;
const unreadAnnouncements = isMe && isDetailed ?
(await this.announcementService.getUnreadAnnouncements(user)).map((announcement) => ({
createdAt: this.idService.parse(announcement.id).date.toISOString(),
...announcement,
})) : null;
const notificationsInfo = isMe && opts.detail ? await this.getNotificationsInfo(user.id) : null;
const notificationsInfo = isMe && isDetailed ? await this.getNotificationsInfo(user.id) : null;
const packed = {
id: user.id,
@ -385,7 +378,7 @@ export class UserEntityService implements OnModuleInit {
displayOrder: r.displayOrder,
}))) : undefined,
...(opts.detail ? {
...(isDetailed ? {
url: profile!.url,
uri: user.uri,
movedTo: user.movedToUri ? this.apPersonService.resolvePerson(user.movedToUri).then(user => user.id).catch(() => null) : null,
@ -443,7 +436,7 @@ export class UserEntityService implements OnModuleInit {
moderationNote: iAmModerator ? (profile!.moderationNote ?? '') : undefined,
} : {}),
...(opts.detail && isMe ? {
...(isDetailed && isMe ? {
avatarId: user.avatarId,
bannerId: user.bannerId,
isModerator: isModerator,
@ -515,19 +508,19 @@ export class UserEntityService implements OnModuleInit {
notify: relation.following?.notify ?? 'none',
withReplies: relation.following?.withReplies ?? false,
} : {}),
} as Promiseable<Packed<'User'>> as Promiseable<IsMeAndIsUserDetailed<ExpectsMe, D>>;
} as Promiseable<Packed<S>>;
return await awaitAll(packed);
}
public packMany<D extends boolean = false>(
public packMany<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
users: (MiUser['id'] | MiUser)[],
me?: { id: MiUser['id'] } | null | undefined,
options?: {
detail?: D,
schema?: S,
includeSecrets?: boolean,
},
): Promise<IsUserDetailed<D>[]> {
): Promise<Packed<S>[]> {
return Promise.all(users.map(u => this.pack(u, me, options)));
}
}

View file

@ -25,7 +25,7 @@ export const packedBlockingSchema = {
blockee: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -30,12 +30,12 @@ export const packedFollowingSchema = {
followee: {
type: 'object',
optional: true, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
follower: {
type: 'object',
optional: true, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -30,7 +30,7 @@ export const packedMutingSchema = {
mutee: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -25,7 +25,7 @@ export const packedRenoteMutingSchema = {
mutee: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -685,13 +685,5 @@ export const packedUserSchema = {
type: 'object',
ref: 'UserDetailed',
},
{
type: 'object',
ref: 'UserDetailedNotMe',
},
{
type: 'object',
ref: 'MeDetailed',
},
],
} as const;

View file

@ -204,7 +204,7 @@ export class ServerService implements OnApplicationShutdown {
});
this.globalEventService.publishMainStream(profile.userId, 'meUpdated', await this.userEntityService.pack(profile.userId, { id: profile.userId }, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -157,7 +157,7 @@ export class ApiServerService {
return {
ok: true,
token: token.token,
user: await this.userEntityService.pack(token.userId, null, { detail: true }),
user: await this.userEntityService.pack(token.userId, null, { schema: 'UserDetailedNotMe' }),
};
} else {
return {

View file

@ -213,7 +213,7 @@ export class SignupApiService {
});
const res = await this.userEntityService.pack(account, account, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
});

View file

@ -62,17 +62,17 @@ export const meta = {
reporter: {
type: 'object',
nullable: false, optional: false,
ref: 'User',
ref: 'UserDetailedNotMe',
},
targetUser: {
type: 'object',
nullable: false, optional: false,
ref: 'User',
ref: 'UserDetailedNotMe',
},
assignee: {
type: 'object',
nullable: true, optional: true,
ref: 'User',
ref: 'UserDetailedNotMe',
},
},
},

View file

@ -11,6 +11,7 @@ import { SignupService } from '@/core/SignupService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { localUsernameSchema, passwordSchema } from '@/models/User.js';
import { DI } from '@/di-symbols.js';
import { Packed } from '@/misc/json-schema.js';
export const meta = {
tags: ['admin'],
@ -18,7 +19,7 @@ export const meta = {
res: {
type: 'object',
optional: false, nullable: false,
ref: 'User',
ref: 'MeDetailed',
properties: {
token: {
type: 'string',
@ -60,11 +61,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
});
const res = await this.userEntityService.pack(account, account, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
});
}) as Packed<'MeDetailed'> & { token: string };
(res as any).token = secret;
res.token = secret;
return res;
});

View file

@ -27,7 +27,7 @@ export const meta = {
res: {
type: 'object',
optional: false, nullable: false,
ref: 'User',
ref: 'UserDetailedNotMe',
},
} as const;
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
const res = await this.userEntityService.pack(profile.user!, null, {
detail: true,
schema: 'UserDetailedNotMe',
});
return res;

View file

@ -40,7 +40,7 @@ export const meta = {
},
required: ['id', 'createdAt', 'user'],
},
}
},
} as const;
export const paramDef = {
@ -92,7 +92,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return await Promise.all(assigns.map(async assign => ({
id: assign.id,
createdAt: this.idService.parse(assign.id).date.toISOString(),
user: await this.userEntityService.pack(assign.user!, me, { detail: true }),
user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
expiresAt: assign.expiresAt?.toISOString() ?? null,
})));
});

View file

@ -50,7 +50,7 @@ export const meta = {
user: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
},

View file

@ -114,7 +114,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -148,7 +148,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (user != null) {
return {
type: 'User',
object: await this.userEntityService.pack(user, me, { detail: true }),
object: await this.userEntityService.pack(user, me, { schema: 'UserDetailedNotMe' }),
};
} else if (note != null) {
try {

View file

@ -112,7 +112,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return {
accessToken: accessToken.token,
user: await this.userEntityService.pack(session.userId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
};
});

View file

@ -102,7 +102,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
await this.userBlockingService.block(blocker, blockee);
return await this.userEntityService.pack(blockee.id, blocker, {
detail: true,
schema: 'UserDetailedNotMe',
});
});
}

View file

@ -103,7 +103,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
await this.userBlockingService.unblock(blocker, blockee);
return await this.userEntityService.pack(blockee.id, blocker, {
detail: true,
schema: 'UserDetailedNotMe',
});
});
}

View file

@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
relations: ['user'],
});
const users = await this.userEntityService.packMany(records.map(r => r.user!), null, { detail: false });
const users = await this.userEntityService.packMany(records.map(r => r.user!), null);
return records.map(r => ({
id: r.id,

View file

@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.limit(ps.limit)
.getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailedNotMe' });
});
}
}

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.limit(ps.limit).getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -71,8 +71,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
userProfile.loggedInDates = [...userProfile.loggedInDates, today];
}
return await this.userEntityService.pack<true, true>(userProfile.user!, userProfile.user!, {
detail: true,
return await this.userEntityService.pack(userProfile.user!, userProfile.user!, {
schema: 'MeDetailed',
includeSecrets: isSecure,
userProfile,
});

View file

@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -111,7 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -74,7 +74,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));
});

View file

@ -97,7 +97,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));
});

View file

@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -66,8 +66,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err;
});
return await this.userEntityService.pack<true, true>(me.id, me, {
detail: true,
return await this.userEntityService.pack(me.id, me, {
schema: 'MeDetailed',
});
});
}

View file

@ -51,8 +51,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err;
});
return await this.userEntityService.pack<true, true>(me.id, me, {
detail: true,
return await this.userEntityService.pack(me.id, me, {
schema: 'MeDetailed',
});
});
}

View file

@ -43,7 +43,7 @@ export const meta = {
res: {
type: 'object',
ref: 'UserDetailed',
ref: 'MeDetailed',
},
} as const;
@ -106,7 +106,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
});
const iObj = await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
});

View file

@ -446,8 +446,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
verifiedLinks: [],
});
const iObj = await this.userEntityService.pack<true, true>(user.id, user, {
detail: true,
const iObj = await this.userEntityService.pack(user.id, user, {
schema: 'MeDetailed',
includeSecrets: isSecure,
});

View file

@ -55,7 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
var: ps.var,
userId: me.id,
user: await this.userEntityService.pack(me.id, { id: page.userId }, {
detail: true,
schema: 'UserDetailed',
}),
});
});

View file

@ -52,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
host: acct.host ?? IsNull(),
})));
return await this.userEntityService.packMany(users.filter(x => x !== null) as MiUser[], me, { detail: true });
return await this.userEntityService.packMany(users.filter(x => x !== null) as MiUser[], me, { schema: 'UserDetailed' });
});
}
}

View file

@ -33,11 +33,11 @@ export const meta = {
properties: {
id: {
type: 'string',
format: 'misskey:id'
format: 'misskey:id',
},
user: {
type: 'object',
ref: 'User'
ref: 'UserDetailed',
},
},
required: ['id', 'user'],
@ -94,7 +94,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return await Promise.all(assigns.map(async assign => ({
id: assign.id,
user: await this.userEntityService.pack(assign.user!, me, { detail: true }),
user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
})));
});
}

View file

@ -89,7 +89,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -122,7 +122,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Make replies object (includes weights)
const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({
user: await this.userEntityService.pack(user, me, { detail: true }),
user: await this.userEntityService.pack(user, me, { schema: 'UserDetailed' }),
weight: repliedUsers[user] / peak,
})));

View file

@ -46,7 +46,7 @@ export const meta = {
},
user: {
type: 'object',
ref: 'User',
ref: 'UserLite',
},
withReplies: {
type: 'boolean',

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.limit(ps.limit).offset(ps.offset).getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -131,7 +131,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.getMany();
}
return await this.userEntityService.packMany(users, me, { detail: !!ps.detail });
return await this.userEntityService.packMany(users, me, { schema: ps.detail ? 'UserDetailed' : 'UserLite' });
});
}
}

View file

@ -141,7 +141,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
return await this.userEntityService.packMany(users, me, { detail: ps.detail });
return await this.userEntityService.packMany(users, me, { schema: ps.detail ? 'UserDetailed' : 'UserLite' });
});
}
}

View file

@ -116,7 +116,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
return await Promise.all(_users.map(u => this.userEntityService.pack(u, me, {
detail: true,
schema: 'UserDetailed',
})));
} else {
// Lookup user
@ -146,7 +146,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
return await this.userEntityService.pack(user, me, {
detail: true,
schema: 'UserDetailed',
});
}
});

View file

@ -81,13 +81,18 @@ export async function mainBoot() {
// ▼南半球
if (month === 7 || month === 8) {
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SnowfallEffect().render();
new SnowfallEffect({}).render();
}
} else {
// ▼北半球
if (month === 12 || month === 1) {
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SnowfallEffect().render();
new SnowfallEffect({}).render();
} else if (month === 3 || month === 4) {
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SakuraEffect({
sakura: true,
}).render();
}
}
}

View file

@ -14,10 +14,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</button>
</header>
<Transition
:enterActiveClass="defaultStore.state.animation ? $style['folder-toggle-enter-active'] : ''"
:leaveActiveClass="defaultStore.state.animation ? $style['folder-toggle-leave-active'] : ''"
:enterFromClass="defaultStore.state.animation ? $style['folder-toggle-enter-from'] : ''"
:leaveToClass="defaultStore.state.animation ? $style['folder-toggle-leave-to'] : ''"
:enterActiveClass="defaultStore.state.animation ? $style.folderToggleEnterActive : ''"
:leaveActiveClass="defaultStore.state.animation ? $style.folderToggleLeaveActive : ''"
:enterFromClass="defaultStore.state.animation ? $style.folderToggleEnterFrom : ''"
:leaveToClass="defaultStore.state.animation ? $style.folderToggleLeaveTo : ''"
@enter="enter"
@afterEnter="afterEnter"
@leave="leave"
@ -100,12 +100,12 @@ onMounted(() => {
</script>
<style lang="scss" module>
.folder-toggle-enter-active, .folder-toggle-leave-active {
.folderToggleEnterActive, .folderToggleLeaveActive {
overflow-y: clip;
transition: opacity 0.5s, height 0.5s !important;
}
.folder-toggle-enter-from, .folder-toggle-leave-to {
.folderToggleEnterFrom, .folderToggleLeaveTo {
opacity: 0;
}

View file

@ -101,7 +101,13 @@ function search() {
limit: 10,
detail: false,
}).then(_users => {
users.value = _users;
users.value = _users.filter((u) => {
if (props.includeSelf === false) {
return u.id !== $i?.id;
} else {
return true;
}
});
});
}
@ -131,18 +137,22 @@ onMounted(() => {
misskeyApi('users/show', {
userIds: defaultStore.state.recentlyUsedUsers,
}).then(foundUsers => {
const _users = foundUsers.filter((u) => {
let _users = foundUsers;
_users = _users.filter((u) => {
if (props.localOnly) {
return u.host == null;
} else {
return true;
}
});
if (props.includeSelf && _users.find(x => $i ? x.id === $i.id : true) == null) {
recentUsers.value = [$i!, ..._users];
} else {
recentUsers.value = _users;
}
_users = _users.filter((u) => {
if (props.includeSelf === false) {
return u.id !== $i?.id;
} else {
return true;
}
});
recentUsers.value = _users;
});
});
</script>

View file

@ -196,7 +196,7 @@ async function matchHeatbeat() {
async function matchUser() {
pleaseLogin();
const user = await os.selectUser({ localOnly: true });
const user = await os.selectUser({ includeSelf: false, localOnly: true });
if (user == null) return;
matchingUser.value = user;

File diff suppressed because one or more lines are too long

View file

@ -2259,7 +2259,7 @@ type ModerationLog = {
id: ID;
createdAt: DateString;
userId: User['id'];
user: UserDetailed | null;
user: UserDetailedNotMe | null;
} & ({
type: 'updateServerSettings';
info: ModerationLogPayloads['updateServerSettings'];

View file

@ -1,7 +1,7 @@
{
"type": "module",
"name": "misskey-js",
"version": "2024.2.0-beta.7",
"version": "2024.2.0-beta.8",
"description": "Misskey SDK for JavaScript",
"types": "./built/dts/index.d.ts",
"exports": {

View file

@ -1,6 +1,6 @@
/*
* version: 2024.2.0-beta.8
* generatedAt: 2024-01-31T01:54:12.227Z
* generatedAt: 2024-02-01T07:26:02.481Z
*/
import type { SwitchCaseResponseType } from '../api.js';

View file

@ -1,6 +1,6 @@
/*
* version: 2024.2.0-beta.8
* generatedAt: 2024-01-31T01:54:12.225Z
* generatedAt: 2024-02-01T07:26:02.478Z
*/
import type {

View file

@ -1,6 +1,6 @@
/*
* version: 2024.2.0-beta.8
* generatedAt: 2024-01-31T01:54:12.223Z
* generatedAt: 2024-02-01T07:26:02.477Z
*/
import { operations } from './types.js';

View file

@ -1,6 +1,6 @@
/*
* version: 2024.2.0-beta.8
* generatedAt: 2024-01-31T01:54:12.222Z
* generatedAt: 2024-02-01T07:26:02.476Z
*/
import { components } from './types.js';

View file

@ -3,7 +3,7 @@
/*
* version: 2024.2.0-beta.8
* generatedAt: 2024-01-31T01:54:12.139Z
* generatedAt: 2024-02-01T07:26:02.396Z
*/
/**
@ -3788,7 +3788,7 @@ export type components = {
UserDetailedNotMe: components['schemas']['UserLite'] & components['schemas']['UserDetailedNotMeOnly'];
MeDetailed: components['schemas']['UserLite'] & components['schemas']['UserDetailedNotMeOnly'] & components['schemas']['MeDetailedOnly'];
UserDetailed: components['schemas']['UserDetailedNotMe'] | components['schemas']['MeDetailed'];
User: components['schemas']['UserLite'] | components['schemas']['UserDetailed'] | components['schemas']['UserDetailedNotMe'] | components['schemas']['MeDetailed'];
User: components['schemas']['UserLite'] | components['schemas']['UserDetailed'];
UserList: {
/**
* Format: id
@ -4191,8 +4191,8 @@ export type components = {
followeeId: string;
/** Format: id */
followerId: string;
followee?: components['schemas']['UserDetailed'];
follower?: components['schemas']['UserDetailed'];
followee?: components['schemas']['UserDetailedNotMe'];
follower?: components['schemas']['UserDetailedNotMe'];
};
Muting: {
/**
@ -4206,7 +4206,7 @@ export type components = {
expiresAt: string | null;
/** Format: id */
muteeId: string;
mutee: components['schemas']['UserDetailed'];
mutee: components['schemas']['UserDetailedNotMe'];
};
RenoteMuting: {
/**
@ -4218,7 +4218,7 @@ export type components = {
createdAt: string;
/** Format: id */
muteeId: string;
mutee: components['schemas']['UserDetailed'];
mutee: components['schemas']['UserDetailedNotMe'];
};
Blocking: {
/**
@ -4230,7 +4230,7 @@ export type components = {
createdAt: string;
/** Format: id */
blockeeId: string;
blockee: components['schemas']['UserDetailed'];
blockee: components['schemas']['UserDetailedNotMe'];
};
Hashtag: {
/** @example misskey */
@ -4883,9 +4883,9 @@ export type operations = {
targetUserId: string;
/** Format: id */
assigneeId: string | null;
reporter: components['schemas']['User'];
targetUser: components['schemas']['User'];
assignee?: components['schemas']['User'] | null;
reporter: components['schemas']['UserDetailedNotMe'];
targetUser: components['schemas']['UserDetailedNotMe'];
assignee?: components['schemas']['UserDetailedNotMe'] | null;
})[];
};
};
@ -4940,7 +4940,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['User'];
'application/json': components['schemas']['MeDetailed'];
};
};
/** @description Client error */
@ -5045,7 +5045,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['User'];
'application/json': components['schemas']['UserDetailedNotMe'];
};
};
/** @description Client error */
@ -8193,7 +8193,7 @@ export type operations = {
info: Record<string, never>;
/** Format: id */
userId: string;
user: components['schemas']['UserDetailed'];
user: components['schemas']['UserDetailedNotMe'];
}[];
};
};
@ -18351,7 +18351,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['UserDetailed'];
'application/json': components['schemas']['MeDetailed'];
};
};
/** @description Client error */
@ -23011,7 +23011,7 @@ export type operations = {
'application/json': {
/** Format: misskey:id */
id: string;
user: components['schemas']['User'];
user: components['schemas']['UserDetailed'];
}[];
};
};
@ -24806,7 +24806,7 @@ export type operations = {
createdAt: string;
/** Format: misskey:id */
userId: string;
user: components['schemas']['User'];
user: components['schemas']['UserLite'];
withReplies: boolean;
}[];
};

View file

@ -1,5 +1,5 @@
import { ModerationLogPayloads } from './consts.js';
import { Announcement, EmojiDetailed, MeDetailed, MeDetailedOnly, Page, User, UserDetailed } from './autogen/models.js';
import { Announcement, EmojiDetailed, MeDetailed, Page, User, UserDetailedNotMe } from './autogen/models.js';
export * from './autogen/entities.js';
export * from './autogen/models.js';
@ -19,7 +19,7 @@ export type ModerationLog = {
id: ID;
createdAt: DateString;
userId: User['id'];
user: UserDetailed | null;
user: UserDetailedNotMe | null;
} & ({
type: 'updateServerSettings';
info: ModerationLogPayloads['updateServerSettings'];