summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/kernel/undo
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-04-13 01:43:22 +0900
committerGitHub <noreply@github.com>2019-04-13 01:43:22 +0900
commit987168b863c52d0548050ffbac569782bb9a8cef (patch)
treec9aa2243dcdcbd044688d201a51c601574bff259 /src/remote/activitypub/kernel/undo
parentFix bug (diff)
downloadsharkey-987168b863c52d0548050ffbac569782bb9a8cef.tar.gz
sharkey-987168b863c52d0548050ffbac569782bb9a8cef.tar.bz2
sharkey-987168b863c52d0548050ffbac569782bb9a8cef.zip
strictNullChecks (#4666)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
Diffstat (limited to 'src/remote/activitypub/kernel/undo')
-rw-r--r--src/remote/activitypub/kernel/undo/block.ts3
-rw-r--r--src/remote/activitypub/kernel/undo/follow.ts3
-rw-r--r--src/remote/activitypub/kernel/undo/index.ts2
-rw-r--r--src/remote/activitypub/kernel/undo/like.ts1
4 files changed, 5 insertions, 4 deletions
diff --git a/src/remote/activitypub/kernel/undo/block.ts b/src/remote/activitypub/kernel/undo/block.ts
index c916a00737..9c277ed7d2 100644
--- a/src/remote/activitypub/kernel/undo/block.ts
+++ b/src/remote/activitypub/kernel/undo/block.ts
@@ -9,13 +9,14 @@ const logger = apLogger;
export default async (actor: IRemoteUser, activity: IBlock): Promise<void> => {
const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+ if (id == null) throw 'missing id';
const uri = activity.id || activity;
logger.info(`UnBlock: ${uri}`);
if (!id.startsWith(config.url + '/')) {
- return null;
+ return;
}
const blockee = await Users.findOne(id.split('/').pop());
diff --git a/src/remote/activitypub/kernel/undo/follow.ts b/src/remote/activitypub/kernel/undo/follow.ts
index cc63a740b1..ce84d0c791 100644
--- a/src/remote/activitypub/kernel/undo/follow.ts
+++ b/src/remote/activitypub/kernel/undo/follow.ts
@@ -7,9 +7,10 @@ import { Users, FollowRequests, Followings } from '../../../../models';
export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+ if (id == null) throw 'missing id';
if (!id.startsWith(config.url + '/')) {
- return null;
+ return;
}
const followee = await Users.findOne(id.split('/').pop());
diff --git a/src/remote/activitypub/kernel/undo/index.ts b/src/remote/activitypub/kernel/undo/index.ts
index 6376ab93a8..5f2e58c3bf 100644
--- a/src/remote/activitypub/kernel/undo/index.ts
+++ b/src/remote/activitypub/kernel/undo/index.ts
@@ -39,6 +39,4 @@ export default async (actor: IRemoteUser, activity: IUndo): Promise<void> => {
undoLike(actor, object as ILike);
break;
}
-
- return null;
};
diff --git a/src/remote/activitypub/kernel/undo/like.ts b/src/remote/activitypub/kernel/undo/like.ts
index f337a0173e..75879d697a 100644
--- a/src/remote/activitypub/kernel/undo/like.ts
+++ b/src/remote/activitypub/kernel/undo/like.ts
@@ -8,6 +8,7 @@ import { Notes } from '../../../../models';
*/
export default async (actor: IRemoteUser, activity: ILike): Promise<void> => {
const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+ if (id == null) throw 'missing id';
const noteId = id.split('/').pop();