mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-04 07:26:29 +09:00
refactor: introduce bindThis decorator to bind this automaticaly
This commit is contained in:
@ -8,6 +8,7 @@ import { UserSuspendService } from '@/core/UserSuspendService.js';
|
||||
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
@ -79,6 +80,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async unFollowAll(follower: User) {
|
||||
const followings = await this.followingsRepository.findBy({
|
||||
followerId: follower.id,
|
||||
@ -97,6 +99,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
}
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async readAllNotify(notifier: User) {
|
||||
await this.notificationsRepository.update({
|
||||
notifierId: notifier.id,
|
||||
|
@ -15,6 +15,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
||||
export const meta = {
|
||||
@ -112,6 +113,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
/***
|
||||
* URIからUserかNoteを解決する
|
||||
*/
|
||||
@bindThis
|
||||
private async fetchAny(uri: string, me: CacheableLocalUser | null | undefined): Promise<SchemaType<typeof meta['res']> | null> {
|
||||
// ブロックしてたら中断
|
||||
const fetchedMeta = await this.metaService.fetch();
|
||||
@ -144,6 +146,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async mergePack(me: CacheableLocalUser | null | undefined, user: User | null | undefined, note: Note | null | undefined): Promise<SchemaType<typeof meta.res> | null> {
|
||||
if (user != null) {
|
||||
return {
|
||||
|
Reference in New Issue
Block a user