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

@@ -3,6 +3,7 @@ import config from '../../config';
import { User } from '../../models/entities/user';
import { Notes, DriveFiles, UserProfiles } from '../../models';
import { In } from 'typeorm';
import { ensure } from '../../prelude/ensure';
export default async function(user: User) {
const author: Author = {
@@ -10,7 +11,7 @@ export default async function(user: User) {
name: user.name || user.username
};
const profile = await UserProfiles.findOne({ userId: user.id });
const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
const notes = await Notes.find({
where: {
@@ -47,9 +48,9 @@ export default async function(user: User) {
title: `New note by ${author.name}`,
link: `${config.url}/notes/${note.id}`,
date: note.createdAt,
description: note.cw,
content: note.text,
image: file ? DriveFiles.getPublicUrl(file) : null
description: note.cw || undefined,
content: note.text || undefined,
image: file ? DriveFiles.getPublicUrl(file) : undefined
});
}