1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-30 15:58:16 +09:00

Merge pull request MisskeyIO#631 from merge-upstream

This commit is contained in:
まっちゃとーにゅ 2024-05-17 05:59:44 +09:00 committed by GitHub
commit 23a12b9579
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 44 additions and 23 deletions

View File

@ -4,12 +4,10 @@
"service": "app", "service": "app",
"workspaceFolder": "/workspace", "workspaceFolder": "/workspace",
"features": { "features": {
"ghcr.io/devcontainers-contrib/features/pnpm:2": {
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": { "ghcr.io/devcontainers/features/node:1": {
"version": "20" "version": "20"
} },
"ghcr.io/devcontainers-contrib/features/corepack:1": {}
}, },
"forwardPorts": [3000], "forwardPorts": [3000],
"postCreateCommand": "sudo chmod 755 .devcontainer/init.sh && .devcontainer/init.sh", "postCreateCommand": "sudo chmod 755 .devcontainer/init.sh && .devcontainer/init.sh",

View File

@ -4,6 +4,8 @@ set -xe
sudo chown -R node /workspace sudo chown -R node /workspace
git submodule update --init git submodule update --init
corepack install
corepack enable
pnpm config set store-dir /home/node/.local/share/pnpm/store pnpm config set store-dir /home/node/.local/share/pnpm/store
pnpm install --frozen-lockfile pnpm install --frozen-lockfile
cp .devcontainer/devcontainer.yml .config/default.yml cp .devcontainer/devcontainer.yml .config/default.yml

1
.github/FUNDING.yml vendored
View File

@ -1,3 +1,4 @@
# These are supported funding model platforms # These are supported funding model platforms
github: [misskey-dev]
patreon: syuilo patreon: syuilo

View File

@ -250,20 +250,41 @@ export class UserEntityService implements OnModuleInit {
] = await Promise.all([ ] = await Promise.all([
this.followingsRepository.findBy({ followerId: me }) this.followingsRepository.findBy({ followerId: me })
.then(f => new Map(f.map(it => [it.followeeId, it]))), .then(f => new Map(f.map(it => [it.followeeId, it]))),
this.followingsRepository.findBy({ followeeId: me }) this.followingsRepository.createQueryBuilder('f')
.then(it => it.map(it => it.followerId)), .select('f.followerId')
this.followRequestsRepository.findBy({ followerId: me }) .where('f.followeeId = :me', { me })
.then(it => it.map(it => it.followeeId)), .getRawMany<{ f_followerId: string }>()
this.followRequestsRepository.findBy({ followeeId: me }) .then(it => it.map(it => it.f_followerId)),
.then(it => it.map(it => it.followerId)), this.followRequestsRepository.createQueryBuilder('f')
this.blockingsRepository.findBy({ blockerId: me }) .select('f.followeeId')
.then(it => it.map(it => it.blockeeId)), .where('f.followerId = :me', { me })
this.blockingsRepository.findBy({ blockeeId: me }) .getRawMany<{ f_followeeId: string }>()
.then(it => it.map(it => it.blockerId)), .then(it => it.map(it => it.f_followeeId)),
this.mutingsRepository.findBy({ muterId: me }) this.followRequestsRepository.createQueryBuilder('f')
.then(it => it.map(it => it.muteeId)), .select('f.followerId')
this.renoteMutingsRepository.findBy({ muterId: me }) .where('f.followeeId = :me', { me })
.then(it => it.map(it => it.muteeId)), .getRawMany<{ f_followerId: string }>()
.then(it => it.map(it => it.f_followerId)),
this.blockingsRepository.createQueryBuilder('b')
.select('b.blockeeId')
.where('b.blockerId = :me', { me })
.getRawMany<{ b_blockeeId: string }>()
.then(it => it.map(it => it.b_blockeeId)),
this.blockingsRepository.createQueryBuilder('b')
.select('b.blockerId')
.where('b.blockeeId = :me', { me })
.getRawMany<{ b_blockerId: string }>()
.then(it => it.map(it => it.b_blockerId)),
this.mutingsRepository.createQueryBuilder('m')
.select('m.muteeId')
.where('m.muterId = :me', { me })
.getRawMany<{ m_muteeId: string }>()
.then(it => it.map(it => it.m_muteeId)),
this.renoteMutingsRepository.createQueryBuilder('m')
.select('m.muteeId')
.where('m.muterId = :me', { me })
.getRawMany<{ m_muteeId: string }>()
.then(it => it.map(it => it.m_muteeId)),
]); ]);
return new Map( return new Map(
@ -641,18 +662,17 @@ export class UserEntityService implements OnModuleInit {
} }
const _userIds = _users.map(u => u.id); const _userIds = _users.map(u => u.id);
// -- 特に前提条件のない値群を取得
const profilesMap = (options?.schema !== 'UserLite') ? await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p]))) : undefined;
// -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得 // -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得
let profilesMap: Map<MiUser['id'], MiUserProfile> = new Map();
let userRelations: Map<MiUser['id'], UserRelation> = new Map(); let userRelations: Map<MiUser['id'], UserRelation> = new Map();
let userMemos: Map<MiUser['id'], string | null> = new Map(); let userMemos: Map<MiUser['id'], string | null> = new Map();
let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map(); let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map();
if (options?.schema !== 'UserLite') { if (options?.schema !== 'UserLite') {
profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
const meId = me ? me.id : null; const meId = me ? me.id : null;
if (meId) { if (meId) {
userMemos = await this.userMemosRepository.findBy({ userId: meId }) userMemos = await this.userMemosRepository.findBy({ userId: meId })