forked from mirror/misskey
?
This commit is contained in:
parent
52939f5661
commit
b1b6966b6b
@ -251,51 +251,4 @@ export class QueryService {
|
|||||||
|
|
||||||
q.setParameters(mutingQuery.getParameters());
|
q.setParameters(mutingQuery.getParameters());
|
||||||
}
|
}
|
||||||
@bindThis
|
|
||||||
public generateChannelQuery(q: SelectQueryBuilder<any>, me?: { id: MiUser['id'] } | null): void {
|
|
||||||
if (me == null) {
|
|
||||||
q.andWhere('note.channelId IS NULL');
|
|
||||||
} else {
|
|
||||||
q.leftJoinAndSelect('note.channel', 'channel');
|
|
||||||
|
|
||||||
const channelFollowingQuery = this.channelFollowingsRepository.createQueryBuilder('channelFollowing')
|
|
||||||
.select('channelFollowing.followeeId')
|
|
||||||
.where('channelFollowing.followerId = :followerId', { followerId: me.id });
|
|
||||||
|
|
||||||
q.andWhere(new Brackets(qb => { qb
|
|
||||||
// チャンネルのノートではない
|
|
||||||
.where('note.channelId IS NULL')
|
|
||||||
// または自分がフォローしているチャンネルのノート
|
|
||||||
.orWhere(`note.channelId IN (${ channelFollowingQuery.getQuery() })`);
|
|
||||||
}));
|
|
||||||
|
|
||||||
q.setParameters(channelFollowingQuery.getParameters());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@bindThis
|
|
||||||
public generateRepliesQuery(q: SelectQueryBuilder<any>, withReplies: boolean, me?: Pick<MiUser, 'id'> | null): void {
|
|
||||||
if (me == null) {
|
|
||||||
q.andWhere(new Brackets(qb => { qb
|
|
||||||
.where('note.replyId IS NULL') // 返信ではない
|
|
||||||
.orWhere(new Brackets(qb => { qb // 返信だけど投稿者自身への返信
|
|
||||||
.where('note.replyId IS NOT NULL')
|
|
||||||
.andWhere('note.replyUserId = note.userId');
|
|
||||||
}));
|
|
||||||
}));
|
|
||||||
} else if (!withReplies) {
|
|
||||||
q.andWhere(new Brackets(qb => { qb
|
|
||||||
.where('note.replyId IS NULL') // 返信ではない
|
|
||||||
.orWhere('note.replyUserId = :meId', { meId: me.id }) // 返信だけど自分のノートへの返信
|
|
||||||
.orWhere(new Brackets(qb => { qb // 返信だけど自分の行った返信
|
|
||||||
.where('note.replyId IS NOT NULL')
|
|
||||||
.andWhere('note.userId = :meId', { meId: me.id });
|
|
||||||
}))
|
|
||||||
.orWhere(new Brackets(qb => { qb // 返信だけど投稿者自身への返信
|
|
||||||
.where('note.replyId IS NOT NULL')
|
|
||||||
.andWhere('note.replyUserId = note.userId');
|
|
||||||
}));
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,7 @@ import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
|||||||
import { WebhookService } from '@/core/WebhookService.js';
|
import { WebhookService } from '@/core/WebhookService.js';
|
||||||
import { NotificationService } from '@/core/NotificationService.js';
|
import { NotificationService } from '@/core/NotificationService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type {
|
import type { FollowingsRepository, FollowRequestsRepository, InstancesRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
||||||
FollowingsRepository,
|
|
||||||
FollowRequestsRepository,
|
|
||||||
InstancesRepository,
|
|
||||||
UserProfilesRepository,
|
|
||||||
UsersRepository,
|
|
||||||
} from '@/models/_.js';
|
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
@ -59,18 +53,25 @@ export class UserFollowingService implements OnModuleInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private moduleRef: ModuleRef,
|
private moduleRef: ModuleRef,
|
||||||
|
|
||||||
@Inject(DI.config)
|
@Inject(DI.config)
|
||||||
private config: Config,
|
private config: Config,
|
||||||
|
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
@Inject(DI.userProfilesRepository)
|
@Inject(DI.userProfilesRepository)
|
||||||
private userProfilesRepository: UserProfilesRepository,
|
private userProfilesRepository: UserProfilesRepository,
|
||||||
|
|
||||||
@Inject(DI.followingsRepository)
|
@Inject(DI.followingsRepository)
|
||||||
private followingsRepository: FollowingsRepository,
|
private followingsRepository: FollowingsRepository,
|
||||||
|
|
||||||
@Inject(DI.followRequestsRepository)
|
@Inject(DI.followRequestsRepository)
|
||||||
private followRequestsRepository: FollowRequestsRepository,
|
private followRequestsRepository: FollowRequestsRepository,
|
||||||
|
|
||||||
@Inject(DI.instancesRepository)
|
@Inject(DI.instancesRepository)
|
||||||
private instancesRepository: InstancesRepository,
|
private instancesRepository: InstancesRepository,
|
||||||
|
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
@ -196,18 +197,10 @@ export class UserFollowingService implements OnModuleInit {
|
|||||||
@bindThis
|
@bindThis
|
||||||
private async insertFollowingDoc(
|
private async insertFollowingDoc(
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox']
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox']
|
|
||||||
},
|
},
|
||||||
follower: {
|
follower: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox']
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox']
|
|
||||||
},
|
},
|
||||||
silent = false,
|
silent = false,
|
||||||
withReplies?: boolean,
|
withReplies?: boolean,
|
||||||
@ -254,7 +247,8 @@ export class UserFollowingService implements OnModuleInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 通知を作成
|
// 通知を作成
|
||||||
this.notificationService.createNotification(follower.id, 'followRequestAccepted', {}, followee.id);
|
this.notificationService.createNotification(follower.id, 'followRequestAccepted', {
|
||||||
|
}, followee.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alreadyFollowed) return;
|
if (alreadyFollowed) return;
|
||||||
@ -328,25 +322,18 @@ export class UserFollowingService implements OnModuleInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 通知を作成
|
// 通知を作成
|
||||||
this.notificationService.createNotification(followee.id, 'follow', {}, follower.id);
|
this.notificationService.createNotification(followee.id, 'follow', {
|
||||||
|
}, follower.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async unfollow(
|
public async unfollow(
|
||||||
follower: {
|
follower: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox'];
|
|
||||||
},
|
},
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox'];
|
|
||||||
},
|
},
|
||||||
silent = false,
|
silent = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@ -477,18 +464,10 @@ export class UserFollowingService implements OnModuleInit {
|
|||||||
@bindThis
|
@bindThis
|
||||||
public async createFollowRequest(
|
public async createFollowRequest(
|
||||||
follower: {
|
follower: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox'];
|
|
||||||
},
|
},
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox'];
|
|
||||||
},
|
},
|
||||||
requestId?: string,
|
requestId?: string,
|
||||||
withReplies?: boolean,
|
withReplies?: boolean,
|
||||||
@ -581,11 +560,7 @@ export class UserFollowingService implements OnModuleInit {
|
|||||||
@bindThis
|
@bindThis
|
||||||
public async acceptFollowRequest(
|
public async acceptFollowRequest(
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox'];
|
|
||||||
},
|
},
|
||||||
follower: MiUser,
|
follower: MiUser,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@ -613,11 +588,7 @@ export class UserFollowingService implements OnModuleInit {
|
|||||||
@bindThis
|
@bindThis
|
||||||
public async acceptAllFollowRequests(
|
public async acceptAllFollowRequests(
|
||||||
user: {
|
user: {
|
||||||
id: MiUser['id'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
host: MiUser['host'];
|
|
||||||
uri: MiUser['host'];
|
|
||||||
inbox: MiUser['inbox'];
|
|
||||||
sharedInbox: MiUser['sharedInbox'];
|
|
||||||
},
|
},
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const requests = await this.followRequestsRepository.findBy({
|
const requests = await this.followRequestsRepository.findBy({
|
||||||
|
@ -27,7 +27,7 @@ import type { UsersRepository, UserProfilesRepository, NotesRepository, DriveFil
|
|||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
import { isNotNull } from '@/misc/is-not-null.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { LdSignatureService } from './LdSignatureService.js';
|
import { LdSignatureService } from './LdSignatureService.js';
|
||||||
import { ApMfmService } from './ApMfmService.js';
|
import { ApMfmService } from './ApMfmService.js';
|
||||||
import type { IAccept, IActivity, IAdd, IAnnounce, IApDocument, IApEmoji, IApHashtag, IApImage, IApMention, IBlock, ICreate, IDelete, IFlag, IFollow, IKey, ILike, IMove, IObject, IPost, IQuestion, IReject, IRemove, ITombstone, IUndo, IUpdate } from './type.js';
|
import type { IAccept, IActivity, IAdd, IAnnounce, IApDocument, IApEmoji, IApHashtag, IApImage, IApMention, IBlock, ICreate, IDelete, IFlag, IFollow, IKey, ILike, IMove, IObject, IPost, IQuestion, IReject, IRemove, ITombstone, IUndo, IUpdate } from './type.js';
|
||||||
|
Loading…
Reference in New Issue
Block a user