summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-17 14:32:59 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-17 14:32:59 +0900
commit0ede390fefb4aae460deccc09755af85e5af6002 (patch)
treea3d86468bd6ef53e206382a2812eb74e2039ccc5 /src
parentFix #4721 Fix #4722 (diff)
downloadsharkey-0ede390fefb4aae460deccc09755af85e5af6002.tar.gz
sharkey-0ede390fefb4aae460deccc09755af85e5af6002.tar.bz2
sharkey-0ede390fefb4aae460deccc09755af85e5af6002.zip
Refactor
Diffstat (limited to 'src')
-rw-r--r--src/models/repositories/user.ts2
-rw-r--r--src/remote/activitypub/renderer/person.ts2
-rw-r--r--src/server/api/endpoints/i/2fa/done.ts2
-rw-r--r--src/server/api/endpoints/i/2fa/register.ts2
-rw-r--r--src/server/api/endpoints/i/2fa/unregister.ts2
-rw-r--r--src/server/api/endpoints/i/change-password.ts2
-rw-r--r--src/server/api/endpoints/i/delete-account.ts2
-rw-r--r--src/server/api/endpoints/i/regenerate-token.ts2
-rw-r--r--src/server/api/endpoints/i/update-email.ts2
-rw-r--r--src/server/api/endpoints/i/update.ts2
-rw-r--r--src/server/api/endpoints/notes/polls/vote.ts2
-rw-r--r--src/server/api/private/signin.ts2
-rw-r--r--src/server/web/feed.ts2
-rw-r--r--src/services/drive/add-file.ts2
-rw-r--r--src/services/note/create.ts2
-rw-r--r--src/services/note/polls/vote.ts2
-rw-r--r--src/services/note/reaction/create.ts2
17 files changed, 17 insertions, 17 deletions
diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts
index 30c77e78ca..36bba05e8e 100644
--- a/src/models/repositories/user.ts
+++ b/src/models/repositories/user.ts
@@ -82,7 +82,7 @@ export class UserRepository extends Repository<User> {
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 3fb164ef4e..efe52cdefb 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 e23678dcbb..c134e1b226 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 76d79b3a49..bd46b7c68c 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 9c7857e7ef..99483143cc 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 0dda125b9c..07d2d864d2 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 389d0b3212..8ec85c9f41 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 56c0362c88..e27cf0b18c 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 15c62a9d08..e02f53a643 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 8649b59c00..2951072cf6 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<User>;
const profileUpdates = {} as Partial<UserProfile>;
- 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 d13405597d..0510e70d3e 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 676546f2aa..02361a139d 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 6b660fe188..88a61af7cc 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 cdb1a60092..9287fa820b 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 8c85a5c275..02e33d6789 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<N
deliverNoteToMentionedRemoteUsers(mentionedUsers, user, noteActivity);
}
- const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
+ const profile = await UserProfiles.findOne(user.id).then(ensure);
// If has in reply to note
if (data.reply) {
diff --git a/src/services/note/polls/vote.ts b/src/services/note/polls/vote.ts
index c6876484f5..aee52ba10d 100644
--- a/src/services/note/polls/vote.ts
+++ b/src/services/note/polls/vote.ts
@@ -67,7 +67,7 @@ export default async function(user: User, note: Note, choice: number) {
}
});
- const profile = await UserProfiles.findOne({ userId: user.id });
+ const profile = await UserProfiles.findOne(user.id);
// ローカルユーザーが投票した場合この投稿をWatchする
if (Users.isLocalUser(user) && profile!.autoWatch) {
diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts
index 0e8bcebdbc..7711ba0737 100644
--- a/src/services/note/reaction/create.ts
+++ b/src/services/note/reaction/create.ts
@@ -80,7 +80,7 @@ export default async (user: User, note: Note, reaction?: string) => {
}
});
- const profile = await UserProfiles.findOne({ userId: user.id });
+ const profile = await UserProfiles.findOne(user.id);
// ユーザーがローカルユーザーかつ自動ウォッチ設定がオンならばこの投稿をWatchする
if (Users.isLocalUser(user) && profile!.autoWatch) {