refactor: prefix Mi for all entities (misskey-dev#11719) (MisskeyIO#160)
cheery-pick from misskey-dev@792622aeadf3e36d50cddec3c64b2ff0105ea927
This commit is contained in:
parent
651905e08f
commit
58bbff3738
234 changed files with 2061 additions and 2061 deletions
|
|
@ -10,8 +10,8 @@ import type { DriveFilesRepository, NotesRepository } from '@/models/index.js';
|
|||
import type { Config } from '@/config.js';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
import type { DriveFile } from '@/models/entities/DriveFile.js';
|
||||
import type { MiUser } from '@/models/entities/User.js';
|
||||
import type { MiDriveFile } from '@/models/entities/DriveFile.js';
|
||||
import { appendQuery, query } from '@/misc/prelude/url.js';
|
||||
import { deepClone } from '@/misc/clone.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
|
@ -65,7 +65,7 @@ export class DriveFileEntityService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public getPublicProperties(file: DriveFile): DriveFile['properties'] {
|
||||
public getPublicProperties(file: MiDriveFile): MiDriveFile['properties'] {
|
||||
if (file.properties.orientation != null) {
|
||||
const properties = deepClone(file.properties);
|
||||
if (file.properties.orientation >= 5) {
|
||||
|
|
@ -90,7 +90,7 @@ export class DriveFileEntityService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public getThumbnailUrl(file: DriveFile): string | null {
|
||||
public getThumbnailUrl(file: MiDriveFile): string | null {
|
||||
if (file.type.startsWith('video')) {
|
||||
if (file.thumbnailUrl) return file.thumbnailUrl;
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ export class DriveFileEntityService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public getPublicUrl(file: DriveFile, mode?: 'avatar'): string { // static = thumbnail
|
||||
public getPublicUrl(file: MiDriveFile, mode?: 'avatar'): string { // static = thumbnail
|
||||
// リモートかつメディアプロキシ
|
||||
if (file.uri != null && file.userHost != null && this.config.externalMediaProxyEnabled) {
|
||||
return this.getProxiedUrl(file.uri, mode);
|
||||
|
|
@ -139,7 +139,7 @@ export class DriveFileEntityService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async calcDriveUsageOf(user: User['id'] | { id: User['id'] }): Promise<number> {
|
||||
public async calcDriveUsageOf(user: MiUser['id'] | { id: MiUser['id'] }): Promise<number> {
|
||||
const id = typeof user === 'object' ? user.id : user;
|
||||
|
||||
const { sum } = await this.driveFilesRepository
|
||||
|
|
@ -190,8 +190,8 @@ export class DriveFileEntityService {
|
|||
|
||||
@bindThis
|
||||
public async pack(
|
||||
src: DriveFile['id'] | DriveFile,
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
src: MiDriveFile['id'] | MiDriveFile,
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
options?: PackOptions,
|
||||
): Promise<Packed<'DriveFile'>> {
|
||||
const opts = Object.assign({
|
||||
|
|
@ -225,8 +225,8 @@ export class DriveFileEntityService {
|
|||
|
||||
@bindThis
|
||||
public async packNullable(
|
||||
src: DriveFile['id'] | DriveFile,
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
src: MiDriveFile['id'] | MiDriveFile,
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
options?: PackOptions,
|
||||
): Promise<Packed<'DriveFile'> | null> {
|
||||
const opts = Object.assign({
|
||||
|
|
@ -261,8 +261,8 @@ export class DriveFileEntityService {
|
|||
|
||||
@bindThis
|
||||
public async packMany(
|
||||
files: DriveFile[],
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
files: MiDriveFile[],
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
options?: PackOptions,
|
||||
): Promise<Packed<'DriveFile'>[]> {
|
||||
return (await Promise.allSettled(files.map(f => this.packNullable(f, me, options))))
|
||||
|
|
@ -272,8 +272,8 @@ export class DriveFileEntityService {
|
|||
|
||||
@bindThis
|
||||
public async packManyByIdsMap(
|
||||
fileIds: DriveFile['id'][],
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
fileIds: MiDriveFile['id'][],
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
options?: PackOptions,
|
||||
): Promise<Map<Packed<'DriveFile'>['id'], Packed<'DriveFile'> | null>> {
|
||||
if (fileIds.length === 0) return new Map();
|
||||
|
|
@ -288,8 +288,8 @@ export class DriveFileEntityService {
|
|||
|
||||
@bindThis
|
||||
public async packManyByIds(
|
||||
fileIds: DriveFile['id'][],
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
fileIds: MiDriveFile['id'][],
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
options?: PackOptions,
|
||||
): Promise<Packed<'DriveFile'>[]> {
|
||||
if (fileIds.length === 0) return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue