summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/service/github.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-04-02 15:34:03 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-04-02 15:34:03 +0900
commit2375359d129b63988b0658f735e1d9c014c10d71 (patch)
treec8b233d00e4b3cbb41b0d211845bdb0cca803267 /packages/backend/src/server/api/service/github.ts
parentMerge branch 'develop' (diff)
parent12.109.0 (diff)
downloadmisskey-2375359d129b63988b0658f735e1d9c014c10d71.tar.gz
misskey-2375359d129b63988b0658f735e1d9c014c10d71.tar.bz2
misskey-2375359d129b63988b0658f735e1d9c014c10d71.zip
Merge branch 'develop'
Diffstat (limited to 'packages/backend/src/server/api/service/github.ts')
-rw-r--r--packages/backend/src/server/api/service/github.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/backend/src/server/api/service/github.ts b/packages/backend/src/server/api/service/github.ts
index ce032db181..61bb768a63 100644
--- a/packages/backend/src/server/api/service/github.ts
+++ b/packages/backend/src/server/api/service/github.ts
@@ -10,6 +10,7 @@ import signin from '../common/signin.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { Users, UserProfiles } from '@/models/index.js';
import { ILocalUser } from '@/models/entities/user.js';
+import { IsNull } from 'typeorm';
function getUserToken(ctx: Koa.BaseContext): string | null {
return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1];
@@ -40,12 +41,12 @@ router.get('/disconnect/github', async ctx => {
return;
}
- const user = await Users.findOneOrFail({
- host: null,
+ const user = await Users.findOneByOrFail({
+ host: IsNull(),
token: userToken,
});
- const profile = await UserProfiles.findOneOrFail(user.id);
+ const profile = await UserProfiles.findOneByOrFail({ userId: user.id });
delete profile.integrations.github;
@@ -184,7 +185,7 @@ router.get('/gh/cb', async ctx => {
return;
}
- signin(ctx, await Users.findOne(link.userId) as ILocalUser, true);
+ signin(ctx, await Users.findOneBy({ id: link.userId }) as ILocalUser, true);
} else {
const code = ctx.query.code;
@@ -227,12 +228,12 @@ router.get('/gh/cb', async ctx => {
return;
}
- const user = await Users.findOneOrFail({
- host: null,
+ const user = await Users.findOneByOrFail({
+ host: IsNull(),
token: userToken,
});
- const profile = await UserProfiles.findOneOrFail(user.id);
+ const profile = await UserProfiles.findOneByOrFail({ userId: user.id });
await UserProfiles.update(user.id, {
integrations: {