forked from mirror/misskey
Update NoteCreateService.ts
This commit is contained in:
parent
3924a9e494
commit
b4c1de11f5
@ -14,7 +14,7 @@ import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mf
|
|||||||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||||
import { MiNote } from '@/models/Note.js';
|
import { MiNote } from '@/models/Note.js';
|
||||||
import type { ChannelsRepository, FollowingsRepository, InstancesRepository, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListJoiningsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListJoiningsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
||||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import type { MiApp } from '@/models/App.js';
|
import type { MiApp } from '@/models/App.js';
|
||||||
import { concat } from '@/misc/prelude/array.js';
|
import { concat } from '@/misc/prelude/array.js';
|
||||||
@ -185,6 +185,9 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||||||
@Inject(DI.followingsRepository)
|
@Inject(DI.followingsRepository)
|
||||||
private followingsRepository: FollowingsRepository,
|
private followingsRepository: FollowingsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.channelFollowingsRepository)
|
||||||
|
private channelFollowingsRepository: ChannelFollowingsRepository,
|
||||||
|
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private noteEntityService: NoteEntityService,
|
private noteEntityService: NoteEntityService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
@ -804,10 +807,33 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||||||
if (note.visibility === 'public' || note.visibility === 'home') {
|
if (note.visibility === 'public' || note.visibility === 'home') {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`userTimelineWithReplies:${user.id}`,
|
`userTimelineWithReplies:${user.id}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '200',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
}
|
}
|
||||||
|
} else if (note.channelId) {
|
||||||
|
const channelFollowings = await this.channelFollowingsRepository.find({
|
||||||
|
where: {
|
||||||
|
followeeId: note.channelId,
|
||||||
|
},
|
||||||
|
select: ['followerId'],
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const channelFollowing of channelFollowings) {
|
||||||
|
redisPipeline.xadd(
|
||||||
|
`homeTimeline:${channelFollowing.followerId}`,
|
||||||
|
'MAXLEN', '~', '200',
|
||||||
|
'*',
|
||||||
|
'note', note.id);
|
||||||
|
|
||||||
|
if (note.fileIds.length > 0) {
|
||||||
|
redisPipeline.xadd(
|
||||||
|
`homeTimelineWithFiles:${channelFollowing.followerId}`,
|
||||||
|
'MAXLEN', '~', '100',
|
||||||
|
'*',
|
||||||
|
'note', note.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: 休眠ユーザーを弾く
|
// TODO: 休眠ユーザーを弾く
|
||||||
// TODO: チャンネルフォロー
|
// TODO: チャンネルフォロー
|
||||||
@ -831,14 +857,14 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||||||
for (const following of followings) {
|
for (const following of followings) {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`homeTimeline:${following.followerId}`,
|
`homeTimeline:${following.followerId}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '200',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
|
|
||||||
if (note.fileIds.length > 0) {
|
if (note.fileIds.length > 0) {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`homeTimelineWithFiles:${following.followerId}`,
|
`homeTimelineWithFiles:${following.followerId}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '100',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
}
|
}
|
||||||
@ -852,14 +878,14 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||||||
for (const userList of userLists) {
|
for (const userList of userLists) {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`userListTimeline:${userList.userListId}`,
|
`userListTimeline:${userList.userListId}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '200',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
|
|
||||||
if (note.fileIds.length > 0) {
|
if (note.fileIds.length > 0) {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`userListTimelineWithFiles:${userList.userListId}`,
|
`userListTimelineWithFiles:${userList.userListId}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '100',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
}
|
}
|
||||||
@ -867,14 +893,14 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||||||
|
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`homeTimeline:${user.id}`,
|
`homeTimeline:${user.id}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '200',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
|
|
||||||
if (note.fileIds.length > 0) {
|
if (note.fileIds.length > 0) {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`homeTimelineWithFiles:${user.id}`,
|
`homeTimelineWithFiles:${user.id}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '100',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
}
|
}
|
||||||
@ -882,14 +908,14 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||||||
if (note.visibility === 'public' || note.visibility === 'home') {
|
if (note.visibility === 'public' || note.visibility === 'home') {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`userTimeline:${user.id}`,
|
`userTimeline:${user.id}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '200',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
|
|
||||||
if (note.fileIds.length > 0) {
|
if (note.fileIds.length > 0) {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
`userTimelineWithFiles:${user.id}`,
|
`userTimelineWithFiles:${user.id}`,
|
||||||
'MAXLEN', '~', '300',
|
'MAXLEN', '~', '100',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
}
|
}
|
||||||
@ -904,7 +930,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||||||
if (note.fileIds.length > 0) {
|
if (note.fileIds.length > 0) {
|
||||||
redisPipeline.xadd(
|
redisPipeline.xadd(
|
||||||
'localTimelineWithFiles',
|
'localTimelineWithFiles',
|
||||||
'MAXLEN', '~', '1000',
|
'MAXLEN', '~', '500',
|
||||||
'*',
|
'*',
|
||||||
'note', note.id);
|
'note', note.id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user