thank you linters

This commit is contained in:
dakkar 2024-10-11 12:20:08 +01:00
parent 3cec5f927e
commit fb9b6b1208
8 changed files with 36 additions and 12 deletions

View file

@ -576,7 +576,7 @@ export class NoteCreateService implements OnApplicationShutdown {
// ハッシュタグ更新 // ハッシュタグ更新
if (data.visibility === 'public' || data.visibility === 'home') { if (data.visibility === 'public' || data.visibility === 'home') {
if (user.isBot && meta.enableBotTrending) { if (user.isBot && this.meta.enableBotTrending) {
this.hashtagService.updateHashtags(user, tags); this.hashtagService.updateHashtags(user, tags);
} else if (!user.isBot) { } else if (!user.isBot) {
this.hashtagService.updateHashtags(user, tags); this.hashtagService.updateHashtags(user, tags);

View file

@ -13,7 +13,7 @@ import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mf
import { extractHashtags } from '@/misc/extract-hashtags.js'; import { extractHashtags } from '@/misc/extract-hashtags.js';
import type { IMentionedRemoteUsers } from '@/models/Note.js'; import type { IMentionedRemoteUsers } from '@/models/Note.js';
import { MiNote } from '@/models/Note.js'; import { MiNote } from '@/models/Note.js';
import type { NoteEditRepository, ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, MiFollowing, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository, PollsRepository } from '@/models/_.js'; import type { NoteEditRepository, ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, MiFollowing, MiMeta, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository, PollsRepository } from '@/models/_.js';
import type { MiDriveFile } from '@/models/DriveFile.js'; import type { MiDriveFile } from '@/models/DriveFile.js';
import type { MiApp } from '@/models/App.js'; import type { MiApp } from '@/models/App.js';
import { concat } from '@/misc/prelude/array.js'; import { concat } from '@/misc/prelude/array.js';

View file

@ -53,16 +53,22 @@ function generateDummyUser(override?: Partial<MiUser>): MiUser {
avatar: null, avatar: null,
bannerId: null, bannerId: null,
banner: null, banner: null,
backgroundId: null,
background: null,
avatarUrl: null, avatarUrl: null,
bannerUrl: null, bannerUrl: null,
backgroundUrl: null,
avatarBlurhash: null, avatarBlurhash: null,
bannerBlurhash: null, bannerBlurhash: null,
backgroundBlurhash: null,
avatarDecorations: [], avatarDecorations: [],
tags: [], tags: [],
isSuspended: false, isSuspended: false,
isLocked: false, isLocked: false,
isSilenced: false,
isBot: false, isBot: false,
isCat: true, isCat: true,
speakAsCat: true,
isRoot: false, isRoot: false,
isExplorable: true, isExplorable: true,
isHibernated: false, isHibernated: false,
@ -76,6 +82,9 @@ function generateDummyUser(override?: Partial<MiUser>): MiUser {
uri: null, uri: null,
followersUri: null, followersUri: null,
token: null, token: null,
approved: true,
signupReason: null,
noindex: false,
...override, ...override,
}; };
} }
@ -118,6 +127,7 @@ function generateDummyNote(override?: Partial<MiNote>): MiNote {
replyUserHost: null, replyUserHost: null,
renoteUserId: null, renoteUserId: null,
renoteUserHost: null, renoteUserHost: null,
updatedAt: null,
...override, ...override,
}; };
} }
@ -182,9 +192,15 @@ function toPackedUserLite(user: MiUser, override?: Packed<'UserLite'>): Packed<'
})), })),
isBot: user.isBot, isBot: user.isBot,
isCat: user.isCat, isCat: user.isCat,
speakAsCat: user.speakAsCat,
emojis: user.emojis, emojis: user.emojis,
onlineStatus: 'active', onlineStatus: 'active',
badgeRoles: [], badgeRoles: [],
noindex: user.noindex,
isModerator: false,
isAdmin: false,
isSystem: false,
isSilenced: user.isSilenced,
...override, ...override,
}; };
} }
@ -201,6 +217,8 @@ function toPackedUserDetailedNotMe(user: MiUser, override?: Packed<'UserDetailed
lastFetchedAt: user.lastFetchedAt?.toISOString() ?? null, lastFetchedAt: user.lastFetchedAt?.toISOString() ?? null,
bannerUrl: user.bannerUrl, bannerUrl: user.bannerUrl,
bannerBlurhash: user.bannerBlurhash, bannerBlurhash: user.bannerBlurhash,
backgroundUrl: user.backgroundUrl,
backgroundBlurhash: user.backgroundBlurhash,
isLocked: user.isLocked, isLocked: user.isLocked,
isSilenced: false, isSilenced: false,
isSuspended: user.isSuspended, isSuspended: user.isSuspended,
@ -236,6 +254,7 @@ function toPackedUserDetailedNotMe(user: MiUser, override?: Packed<'UserDetailed
isRenoteMuted: false, isRenoteMuted: false,
notify: 'none', notify: 'none',
withReplies: true, withReplies: true,
ListenBrainz: null,
...override, ...override,
}; };
} }

View file

@ -142,6 +142,10 @@ export const packedUserLiteSchema = {
type: 'boolean', type: 'boolean',
nullable: false, optional: true, nullable: false, optional: true,
}, },
isSilenced: {
type: 'boolean',
nullable: false, optional: false,
},
instance: { instance: {
type: 'object', type: 'object',
nullable: false, optional: true, nullable: false, optional: true,

View file

@ -155,8 +155,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
notes = notes.filter(note => { notes = notes.filter(note => {
if (note.user?.isSilenced && me && followings && note.userId !== me.id && !followings[note.userId]) return false; if (note.user?.isSilenced && me && followings && note.userId !== me.id && !followings[note.userId]) return false;
if (note.user?.isSuspended) return false; if (note.user?.isSuspended) return false;
if (note.userHost) {
if (this.utilityService.isFederationAllowedHost(note.userHost)) return false; if (this.utilityService.isFederationAllowedHost(note.userHost)) return false;
if (this.utilityService.isSilencedHost(this.serverSettings.silencedHosts, note.userHost)) return false; if (this.utilityService.isSilencedHost(this.serverSettings.silencedHosts, note.userHost)) return false;
}
return true; return true;
}); });

View file

@ -5,7 +5,6 @@
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { MiMeta } from '@/models/_.js';
import type { Packed } from '@/misc/json-schema.js'; import type { Packed } from '@/misc/json-schema.js';
import { MetaService } from '@/core/MetaService.js'; import { MetaService } from '@/core/MetaService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
@ -23,11 +22,10 @@ class BubbleTimelineChannel extends Channel {
private withRenotes: boolean; private withRenotes: boolean;
private withFiles: boolean; private withFiles: boolean;
private withBots: boolean; private withBots: boolean;
private instance: MiMeta;
constructor( constructor(
@Inject(DI.meta) private metaService: MetaService,
private serverSettings: MiMeta,
private roleService: RoleService, private roleService: RoleService,
private noteEntityService: NoteEntityService, private noteEntityService: NoteEntityService,
@ -46,6 +44,7 @@ class BubbleTimelineChannel extends Channel {
this.withRenotes = !!(params.withRenotes ?? true); this.withRenotes = !!(params.withRenotes ?? true);
this.withFiles = !!(params.withFiles ?? false); this.withFiles = !!(params.withFiles ?? false);
this.withBots = !!(params.withBots ?? true); this.withBots = !!(params.withBots ?? true);
this.instance = await this.metaService.fetch();
// Subscribe events // Subscribe events
this.subscriber.on('notesStream', this.onNote); this.subscriber.on('notesStream', this.onNote);
@ -56,7 +55,7 @@ class BubbleTimelineChannel extends Channel {
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return; if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
if (!this.withBots && note.user.isBot) return; if (!this.withBots && note.user.isBot) return;
if (!(note.user.host != null && this.serverSettings.bubbleInstances.includes(note.user.host) && note.visibility === 'public' )) return; if (!(note.user.host != null && this.instance.bubbleInstances.includes(note.user.host) && note.visibility === 'public' )) return;
if (note.channelId != null) return; if (note.channelId != null) return;

View file

@ -160,7 +160,7 @@ export class ClientServerService {
}, { }, {
// 空文字列の場合右辺を使いたいため // 空文字列の場合右辺を使いたいため
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
'src': instance.app512IconUrl || '/static-assets/icons/512.png', 'src': this.meta.app512IconUrl || '/static-assets/icons/512.png',
'sizes': '300x300', 'sizes': '300x300',
'type': 'image/png', 'type': 'image/png',
'purpose': 'any', 'purpose': 'any',