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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
214 changed files with 939 additions and 785 deletions

View file

@ -77,9 +77,8 @@ export async function removePinned(user: User, noteId: Note['id']) {
}
export async function deliverPinnedChange(userId: User['id'], noteId: Note['id'], isAddition: boolean) {
const user = await Users.findOne({
id: userId
});
const user = await Users.findOne(userId);
if (user == null) throw 'user not found';
if (!Users.isLocalUser(user)) return;
@ -108,14 +107,8 @@ async function CreateRemoteInboxes(user: ILocalUser): Promise<string[]> {
const queue: string[] = [];
for (const following of followers) {
const follower = {
host: following.followerHost,
inbox: following.followerInbox,
sharedInbox: following.followerSharedInbox,
};
if (follower.host !== null) {
const inbox = follower.sharedInbox || follower.inbox;
if (Followings.isRemoteFollower(following)) {
const inbox = following.followerSharedInbox || following.followerInbox;
if (!queue.includes(inbox)) queue.push(inbox);
}
}

View file

@ -6,9 +6,8 @@ import { User } from '../../models/entities/user';
import { renderPerson } from '../../remote/activitypub/renderer/person';
export async function publishToFollowers(userId: User['id']) {
const user = await Users.findOne({
id: userId
});
const user = await Users.findOne(userId);
if (user == null) throw 'user not found';
const followers = await Followings.find({
followeeId: user.id
@ -19,7 +18,7 @@ export async function publishToFollowers(userId: User['id']) {
// フォロワーがリモートユーザーかつ投稿者がローカルユーザーならUpdateを配信
if (Users.isLocalUser(user)) {
for (const following of followers) {
if (following.followerHost !== null) {
if (Followings.isRemoteFollower(following)) {
const inbox = following.followerSharedInbox || following.followerInbox;
if (!queue.includes(inbox)) queue.push(inbox);
}