From 54aef5fe6f2c2b9e40a9af5352124fef7cc8a298 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 23 Feb 2020 03:11:51 +0900 Subject: [PATCH 1/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d151c1078..a7452d9db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ChangeLog 12.21.0 (2020/02/23) ------------------- ### ✨Improvements +* タイムラインに挿入されるおすすめノートに自分がリアクションしたものは含めないように * ノートのメニューに詳細ページへのリンクを追加 * UIの調整 From 6a732ab1cd5397a523c10d3b7f32a22c23697a1e Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 31 Mar 2020 08:07:10 +0900 Subject: [PATCH 2/2] Fix #6203 --- src/server/api/common/signup.ts | 6 +++--- src/server/api/endpoints/admin/accounts/create.ts | 4 +++- src/server/api/endpoints/meta.ts | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/server/api/common/signup.ts b/src/server/api/common/signup.ts index b6e13b36f..26a9d03e0 100644 --- a/src/server/api/common/signup.ts +++ b/src/server/api/common/signup.ts @@ -22,8 +22,6 @@ export async function signup(username: User['username'], password: UserProfile[' throw new Error('INVALID_PASSWORD'); } - const usersCount = await Users.count({}); - // Generate hash of password const salt = await bcrypt.genSalt(8); const hash = await bcrypt.hash(password, salt); @@ -76,7 +74,9 @@ export async function signup(username: User['username'], password: UserProfile[' usernameLower: username.toLowerCase(), host: toPunyNullable(host), token: secret, - isAdmin: usersCount === 0, + isAdmin: (await Users.count({ + host: null, + })) === 0, })); await transactionalEntityManager.save(new UserKeypair({ diff --git a/src/server/api/endpoints/admin/accounts/create.ts b/src/server/api/endpoints/admin/accounts/create.ts index ac80b579b..9d4712e72 100644 --- a/src/server/api/endpoints/admin/accounts/create.ts +++ b/src/server/api/endpoints/admin/accounts/create.ts @@ -17,7 +17,9 @@ export const meta = { }; export default define(meta, async (ps, me) => { - const noUsers = (await Users.count({})) === 0; + const noUsers = (await Users.count({ + host: null, + })) === 0; if (!noUsers && me == null) throw new Error('access denied'); const { account, secret } = await signup(ps.username, ps.password); diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 41adc855d..0cb6f75f1 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -137,7 +137,9 @@ export default define(meta, async (ps, me) => { category: e.category, url: e.url, })), - requireSetup: (await Users.count({})) === 0, + requireSetup: (await Users.count({ + host: null, + })) === 0, enableEmail: instance.enableEmail, enableTwitterIntegration: instance.enableTwitterIntegration,