Merge branch 'develop' into feature/2024.9.0

This commit is contained in:
Hazelnoot 2024-10-13 11:35:10 -04:00
commit 2cd41228d8
6 changed files with 37 additions and 7 deletions

View file

@ -529,7 +529,8 @@ enumの列挙の内容の削除は、その値をもつレコードを全て削
### Migration作成方法 ### Migration作成方法
packages/backendで: packages/backendで:
```sh ```sh
pnpm dlx typeorm migration:generate -d ormconfig.js -o <migration name> pnpm run build
pnpm dlx typeorm migration:generate -d ormconfig.js -o migration/<migration name>
``` ```
- 生成後、ファイルをmigration下に移してください - 生成後、ファイルをmigration下に移してください

View file

@ -12,6 +12,8 @@ import { IdService } from '@/core/IdService.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { UtilityService } from '@/core/UtilityService.js'; import { UtilityService } from '@/core/UtilityService.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
import { QueryFailedError } from 'typeorm';
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
@Injectable() @Injectable()
export class FederatedInstanceService implements OnApplicationShutdown { export class FederatedInstanceService implements OnApplicationShutdown {
@ -56,11 +58,24 @@ export class FederatedInstanceService implements OnApplicationShutdown {
const index = await this.instancesRepository.findOneBy({ host }); const index = await this.instancesRepository.findOneBy({ host });
if (index == null) { if (index == null) {
const i = await this.instancesRepository.insertOne({ let i;
try {
i = await this.instancesRepository.insertOne({
id: this.idService.gen(), id: this.idService.gen(),
host, host,
firstRetrievedAt: new Date(), firstRetrievedAt: new Date(),
}); });
} catch (e: unknown) {
if (e instanceof QueryFailedError) {
if (isDuplicateKeyValueError(e)) {
i = await this.instancesRepository.findOneBy({ host });
}
}
if (i == null) {
throw e;
}
}
this.federatedInstanceCache.set(host, i); this.federatedInstanceCache.set(host, i);
return i; return i;

View file

@ -59,6 +59,7 @@ export class InstanceEntityService {
infoUpdatedAt: instance.infoUpdatedAt ? instance.infoUpdatedAt.toISOString() : null, infoUpdatedAt: instance.infoUpdatedAt ? instance.infoUpdatedAt.toISOString() : null,
latestRequestReceivedAt: instance.latestRequestReceivedAt ? instance.latestRequestReceivedAt.toISOString() : null, latestRequestReceivedAt: instance.latestRequestReceivedAt ? instance.latestRequestReceivedAt.toISOString() : null,
isNSFW: instance.isNSFW, isNSFW: instance.isNSFW,
rejectReports: instance.rejectReports,
moderationNote: iAmModerator ? instance.moderationNote : null, moderationNote: iAmModerator ? instance.moderationNote : null,
}; };
} }

View file

@ -121,6 +121,11 @@ export const packedFederationInstanceSchema = {
optional: false, optional: false,
nullable: false, nullable: false,
}, },
rejectReports: {
type: 'boolean',
optional: false,
nullable: false,
},
moderationNote: { moderationNote: {
type: 'string', type: 'string',
optional: true, nullable: true, optional: true, nullable: true,

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.users"> <div :class="$style.users">
<div v-for="u in users" :key="u.id" :class="$style.user"> <div v-for="u in users" :key="u.id" :class="$style.user">
<MkAvatar :class="$style.avatar" :user="u"/> <MkAvatar :class="$style.avatar" :user="u"/>
<MkUserName :user="u" :nowrap="true"/> <MkUserName :user="u" :nowrap="true" :class="$style.username"/>
</div> </div>
<div v-if="count > 10" :class="$style.more">+{{ count - 10 }}</div> <div v-if="count > 10" :class="$style.more">+{{ count - 10 }}</div>
</div> </div>
@ -99,4 +99,11 @@ function getReactionName(reaction: string): string {
.more { .more {
padding-top: 4px; padding-top: 4px;
} }
.username {
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
overflow: hidden;
}
</style> </style>

View file

@ -4808,6 +4808,7 @@ export type components = {
/** Format: date-time */ /** Format: date-time */
latestRequestReceivedAt: string | null; latestRequestReceivedAt: string | null;
isNSFW: boolean; isNSFW: boolean;
rejectReports: boolean;
moderationNote?: string | null; moderationNote?: string | null;
}; };
GalleryPost: { GalleryPost: {