summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAya Morisawa <AyaMorisawa4869@gmail.com>2018-07-23 13:56:25 +0900
committerAya Morisawa <AyaMorisawa4869@gmail.com>2018-07-23 13:56:25 +0900
commit427b3dcd73d361fc77d49c33b6b4022329214f71 (patch)
tree900846551d85e205a7e1d271e0792f90f78e423e /src
parentFix #1957 (diff)
downloadsharkey-427b3dcd73d361fc77d49c33b6b4022329214f71.tar.gz
sharkey-427b3dcd73d361fc77d49c33b6b4022329214f71.tar.bz2
sharkey-427b3dcd73d361fc77d49c33b6b4022329214f71.zip
Fix semantic errors
Diffstat (limited to 'src')
-rw-r--r--src/server/api/private/signin.ts17
-rw-r--r--src/server/api/private/signup.ts12
-rw-r--r--src/server/web/docs.ts4
-rw-r--r--src/services/note/create.ts18
4 files changed, 27 insertions, 24 deletions
diff --git a/src/server/api/private/signin.ts b/src/server/api/private/signin.ts
index 5abb96d029..9719329ddb 100644
--- a/src/server/api/private/signin.ts
+++ b/src/server/api/private/signin.ts
@@ -11,9 +11,10 @@ export default async (ctx: Koa.Context) => {
ctx.set('Access-Control-Allow-Origin', config.url);
ctx.set('Access-Control-Allow-Credentials', 'true');
- const username = ctx.request.body['username'];
- const password = ctx.request.body['password'];
- const token = ctx.request.body['token'];
+ const body = ctx.request.body as any;
+ const username = body['username'];
+ const password = body['password'];
+ const token = body['token'];
if (typeof username != 'string') {
ctx.status = 400;
@@ -35,11 +36,11 @@ export default async (ctx: Koa.Context) => {
usernameLower: username.toLowerCase(),
host: null
}, {
- fields: {
- data: false,
- profile: false
- }
- }) as ILocalUser;
+ fields: {
+ data: false,
+ profile: false
+ }
+ }) as ILocalUser;
if (user === null) {
ctx.throw(404, {
diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts
index b969b75fc0..563b6ca845 100644
--- a/src/server/api/private/signup.ts
+++ b/src/server/api/private/signup.ts
@@ -14,10 +14,12 @@ if (config.recaptcha) {
}
export default async (ctx: Koa.Context) => {
+ const body = ctx.request.body as any;
+
// Verify recaptcha
// ただしテスト時はこの機構は障害となるため無効にする
if (process.env.NODE_ENV !== 'test' && config.recaptcha != null) {
- const success = await recaptcha(ctx.request.body['g-recaptcha-response']);
+ const success = await recaptcha(body['g-recaptcha-response']);
if (!success) {
ctx.throw(400, 'recaptcha-failed');
@@ -25,8 +27,8 @@ export default async (ctx: Koa.Context) => {
}
}
- const username = ctx.request.body['username'];
- const password = ctx.request.body['password'];
+ const username = body['username'];
+ const password = body['password'];
// Validate username
if (!validateUsername(username)) {
@@ -46,8 +48,8 @@ export default async (ctx: Koa.Context) => {
usernameLower: username.toLowerCase(),
host: null
}, {
- limit: 1
- });
+ limit: 1
+ });
// Check username already used
if (usernameExist !== 0) {
diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts
index 05242e3616..f0181c4b94 100644
--- a/src/server/web/docs.ts
+++ b/src/server/web/docs.ts
@@ -181,10 +181,10 @@ router.get('/*/api/endpoints/*', async ctx => {
},
// @ts-ignore
params: ep.meta.params ? sortParams(Object.entries(ep.meta.params).map(([k, v]) => parseParamDefinition(k, v))) : null,
- paramDefs: ep.meta.params ? extractParamDefRef(Object.entries(ep.meta.params).map(([k, v]) => v)) : null,
+ paramDefs: ep.meta.params ? extractParamDefRef(Object.values(ep.meta.params)) : null,
res: ep.meta.res,
resProps: ep.meta.res && ep.meta.res.props ? sortParams(Object.entries(ep.meta.res.props).map(([k, v]) => parsePropDefinition(k, v))) : null,
- resDefs: null, //extractPropDefRef(Object.entries(ep.res.props).map(([k, v]) => parsePropDefinition(k, v)))
+ resDefs: null as any, //extractPropDefRef(Object.entries(ep.res.props).map(([k, v]) => parsePropDefinition(k, v)))
src: `https://github.com/syuilo/misskey/tree/master/src/server/api/endpoints/${name}.ts`
};
diff --git a/src/services/note/create.ts b/src/services/note/create.ts
index 8536b8b561..340120053b 100644
--- a/src/services/note/create.ts
+++ b/src/services/note/create.ts
@@ -363,10 +363,10 @@ async function notifyToWatchersOfRenotee(renote: INote, user: IUser, nm: Notific
noteId: renote._id,
userId: { $ne: user._id }
}, {
- fields: {
- userId: true
- }
- });
+ fields: {
+ userId: true
+ }
+ });
watchers.forEach(watcher => {
nm.push(watcher.userId, type);
@@ -378,10 +378,10 @@ async function notifyToWatchersOfReplyee(reply: INote, user: IUser, nm: Notifica
noteId: reply._id,
userId: { $ne: user._id }
}, {
- fields: {
- userId: true
- }
- });
+ fields: {
+ userId: true
+ }
+ });
watchers.forEach(watcher => {
nm.push(watcher.userId, 'reply');
@@ -432,7 +432,7 @@ async function publishToFollowers(note: INote, noteObj: any, user: IUser, noteAc
});
queue.forEach(inbox => {
- deliver(user, noteActivity, inbox);
+ deliver(user as any, noteActivity, inbox);
});
}