strictNullChecks (#4666)

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip
This commit is contained in:
syuilo
2019-04-13 01:43:22 +09:00
committed by GitHub
parent 4ee40c3345
commit 987168b863
214 changed files with 939 additions and 785 deletions

View File

@@ -14,6 +14,7 @@ import { PollVotes, NoteWatchings, Users, Polls, UserProfiles } from '../../../.
import { Not } from 'typeorm';
import { IRemoteUser } from '../../../../../models/entities/user';
import { genId } from '../../../../../misc/gen-id';
import { ensure } from '../../../../../prelude/ensure';
export const meta = {
desc: {
@@ -87,7 +88,7 @@ export default define(meta, async (ps, user) => {
throw new ApiError(meta.errors.noPoll);
}
const poll = await Polls.findOne({ noteId: note.id });
const poll = await Polls.findOne({ noteId: note.id }).then(ensure);
if (poll.expiresAt && poll.expiresAt < createdAt) {
throw new ApiError(meta.errors.alreadyExpired);
@@ -149,7 +150,7 @@ export default define(meta, async (ps, user) => {
}
});
const profile = await UserProfiles.findOne({ userId: user.id });
const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
// この投稿をWatchする
if (profile.autoWatch !== false) {
@@ -158,7 +159,7 @@ export default define(meta, async (ps, user) => {
// リモート投票の場合リプライ送信
if (note.userHost != null) {
const pollOwner: IRemoteUser = await Users.findOne(note.userId);
const pollOwner = await Users.findOne(note.userId).then(ensure) as IRemoteUser;
deliver(user, renderActivity(await renderVote(user, vote, note, poll, pollOwner)), pollOwner.inbox);
}