refactor: resolve #7139
This commit is contained in:
parent
ebadd7fd3f
commit
91172654e4
76 changed files with 107 additions and 221 deletions
|
|
@ -5,7 +5,6 @@ import { fetchMeta } from '../../../misc/fetch-meta';
|
|||
import { apLogger } from '../logger';
|
||||
import { DriveFile } from '../../../models/entities/drive-file';
|
||||
import { DriveFiles } from '../../../models';
|
||||
import { ensure } from '../../../prelude/ensure';
|
||||
|
||||
const logger = apLogger;
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ export async function createImage(actor: IRemoteUser, value: any): Promise<Drive
|
|||
uri: image.url
|
||||
});
|
||||
|
||||
file = await DriveFiles.findOne(file.id).then(ensure);
|
||||
file = await DriveFiles.findOneOrFail(file.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, i
|
|||
import { Emoji } from '../../../models/entities/emoji';
|
||||
import { genId } from '../../../misc/gen-id';
|
||||
import { fetchMeta } from '../../../misc/fetch-meta';
|
||||
import { ensure } from '../../../prelude/ensure';
|
||||
import { getApLock } from '../../../misc/app-lock';
|
||||
import { createMessage } from '../../../services/messages/create';
|
||||
import { parseAudience } from '../audience';
|
||||
|
|
@ -201,7 +200,7 @@ export async function createNote(value: string | IObject, resolver?: Resolver, s
|
|||
|
||||
// vote
|
||||
if (reply && reply.hasPoll) {
|
||||
const poll = await Polls.findOne(reply.id).then(ensure);
|
||||
const poll = await Polls.findOneOrFail(reply.id);
|
||||
|
||||
const tryCreateVote = async (name: string, index: number): Promise<null> => {
|
||||
if (poll.expiresAt && Date.now() > new Date(poll.expiresAt).getTime()) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import { toPuny } from '../../../misc/convert-host';
|
|||
import { UserProfile } from '../../../models/entities/user-profile';
|
||||
import { validActor } from '../../../remote/activitypub/type';
|
||||
import { getConnection } from 'typeorm';
|
||||
import { ensure } from '../../../prelude/ensure';
|
||||
import { toArray } from '../../../prelude/array';
|
||||
import { fetchInstanceMetadata } from '../../../services/fetch-instance-metadata';
|
||||
import { normalizeForSearch } from '../../../misc/normalize-for-search';
|
||||
|
|
@ -457,7 +456,7 @@ export function analyzeAttachments(attachments: IObject | IObject[] | undefined)
|
|||
}
|
||||
|
||||
export async function updateFeatured(userId: User['id']) {
|
||||
const user = await Users.findOne(userId).then(ensure);
|
||||
const user = await Users.findOneOrFail(userId);
|
||||
if (!Users.isRemoteUser(user)) return;
|
||||
if (!user.featured) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue