diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 30c77e78c..36bba05e8 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -82,7 +82,7 @@ export class UserRepository extends Repository { const relation = meId && (meId !== user.id) && opts.detail ? await this.getRelation(meId, user.id) : null; const pins = opts.detail ? await UserNotePinings.find({ userId: user.id }) : []; - const profile = opts.detail ? await UserProfiles.findOne({ userId: user.id }).then(ensure) : null; + const profile = opts.detail ? await UserProfiles.findOne(user.id).then(ensure) : null; const falsy = opts.detail ? false : undefined; diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts index 3fb164ef4..efe52cdef 100644 --- a/src/remote/activitypub/renderer/person.ts +++ b/src/remote/activitypub/renderer/person.ts @@ -17,7 +17,7 @@ export async function renderPerson(user: ILocalUser) { const [avatar, banner, profile] = await Promise.all([ user.avatarId ? DriveFiles.findOne(user.avatarId) : Promise.resolve(undefined), user.bannerId ? DriveFiles.findOne(user.bannerId) : Promise.resolve(undefined), - UserProfiles.findOne({ userId: user.id }).then(ensure) + UserProfiles.findOne(user.id).then(ensure) ]); const attachment: { diff --git a/src/server/api/endpoints/i/2fa/done.ts b/src/server/api/endpoints/i/2fa/done.ts index e23678dcb..c134e1b22 100644 --- a/src/server/api/endpoints/i/2fa/done.ts +++ b/src/server/api/endpoints/i/2fa/done.ts @@ -19,7 +19,7 @@ export const meta = { export default define(meta, async (ps, user) => { const token = ps.token.replace(/\s/g, ''); - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); if (profile.twoFactorTempSecret == null) { throw new Error('二段階認証の設定が開始されていません'); diff --git a/src/server/api/endpoints/i/2fa/register.ts b/src/server/api/endpoints/i/2fa/register.ts index 76d79b3a4..bd46b7c68 100644 --- a/src/server/api/endpoints/i/2fa/register.ts +++ b/src/server/api/endpoints/i/2fa/register.ts @@ -20,7 +20,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // Compare password const same = await bcrypt.compare(ps.password, profile.password!); diff --git a/src/server/api/endpoints/i/2fa/unregister.ts b/src/server/api/endpoints/i/2fa/unregister.ts index 9c7857e7e..99483143c 100644 --- a/src/server/api/endpoints/i/2fa/unregister.ts +++ b/src/server/api/endpoints/i/2fa/unregister.ts @@ -17,7 +17,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // Compare password const same = await bcrypt.compare(ps.password, profile.password!); diff --git a/src/server/api/endpoints/i/change-password.ts b/src/server/api/endpoints/i/change-password.ts index 0dda125b9..07d2d864d 100644 --- a/src/server/api/endpoints/i/change-password.ts +++ b/src/server/api/endpoints/i/change-password.ts @@ -21,7 +21,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // Compare password const same = await bcrypt.compare(ps.currentPassword, profile.password!); diff --git a/src/server/api/endpoints/i/delete-account.ts b/src/server/api/endpoints/i/delete-account.ts index 389d0b321..8ec85c9f4 100644 --- a/src/server/api/endpoints/i/delete-account.ts +++ b/src/server/api/endpoints/i/delete-account.ts @@ -17,7 +17,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // Compare password const same = await bcrypt.compare(ps.password, profile.password!); diff --git a/src/server/api/endpoints/i/regenerate-token.ts b/src/server/api/endpoints/i/regenerate-token.ts index 56c0362c8..e27cf0b18 100644 --- a/src/server/api/endpoints/i/regenerate-token.ts +++ b/src/server/api/endpoints/i/regenerate-token.ts @@ -19,7 +19,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // Compare password const same = await bcrypt.compare(ps.password, profile.password!); diff --git a/src/server/api/endpoints/i/update-email.ts b/src/server/api/endpoints/i/update-email.ts index 15c62a9d0..e02f53a64 100644 --- a/src/server/api/endpoints/i/update-email.ts +++ b/src/server/api/endpoints/i/update-email.ts @@ -33,7 +33,7 @@ export const meta = { }; export default define(meta, async (ps, user) => { - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // Compare password const same = await bcrypt.compare(ps.password, profile.password!); diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 8649b59c0..2951072cf 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -160,7 +160,7 @@ export default define(meta, async (ps, user, app) => { const updates = {} as Partial; const profileUpdates = {} as Partial; - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); if (ps.name !== undefined) updates.name = ps.name; if (ps.description !== undefined) profileUpdates.description = ps.description; diff --git a/src/server/api/endpoints/notes/polls/vote.ts b/src/server/api/endpoints/notes/polls/vote.ts index d13405597..0510e70d3 100644 --- a/src/server/api/endpoints/notes/polls/vote.ts +++ b/src/server/api/endpoints/notes/polls/vote.ts @@ -150,7 +150,7 @@ export default define(meta, async (ps, user) => { } }); - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // この投稿をWatchする if (profile.autoWatch !== false) { diff --git a/src/server/api/private/signin.ts b/src/server/api/private/signin.ts index 676546f2a..02361a139 100644 --- a/src/server/api/private/signin.ts +++ b/src/server/api/private/signin.ts @@ -46,7 +46,7 @@ export default async (ctx: Koa.BaseContext) => { return; } - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); // Compare password const same = await bcrypt.compare(password, profile.password!); diff --git a/src/server/web/feed.ts b/src/server/web/feed.ts index 6b660fe18..88a61af7c 100644 --- a/src/server/web/feed.ts +++ b/src/server/web/feed.ts @@ -11,7 +11,7 @@ export default async function(user: User) { name: user.name || user.username }; - const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure); + const profile = await UserProfiles.findOne(user.id).then(ensure); const notes = await Notes.find({ where: { diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index cdb1a6009..9287fa820 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -372,7 +372,7 @@ export default async function( propPromises = [calcWh(), calcAvg()]; } - const profile = await UserProfiles.findOne({ userId: user.id }); + const profile = await UserProfiles.findOne(user.id); const [folder] = await Promise.all([fetchFolder(), Promise.all(propPromises)]); diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 8c85a5c27..02e33d678 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -253,7 +253,7 @@ export default async (user: User, data: Option, silent = false) => new Promise { } }); - const profile = await UserProfiles.findOne({ userId: user.id }); + const profile = await UserProfiles.findOne(user.id); // ユーザーがローカルユーザーかつ自動ウォッチ設定がオンならばこの投稿をWatchする if (Users.isLocalUser(user) && profile!.autoWatch) {