feat: サーバーサイレンス機能を追加 (#12031)

* feat : サーバーサイレンスを追加

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update locale

* Update instance-info.vue

* update misskey-js.api.md

* lint fix

* migration fix

* 既存のものを使うように

* fix

* 色々直した

* Update packages/frontend/src/pages/admin/instance-block.vue

* Update packages/frontend/src/pages/admin/instance-block.vue

* Update packages/frontend/src/components/MkInstanceCardMini.vue

* Update packages/backend/src/core/entities/InstanceEntityService.ts

* Update packages/backend/src/core/entities/InstanceEntityService.ts

* Update packages/backend/src/core/entities/InstanceEntityService.ts

* Update packages/backend/src/core/UserFollowingService.ts

* Update packages/backend/src/core/UserFollowingService.ts

* fix: サイレンスされてるサーバーからの投稿は全部ホームにする

* fix: undefinedでfalseを返すようにした

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
まっちゃてぃー 2023-10-16 20:11:27 +09:00 committed by GitHub
parent 1966876320
commit 5efd01ba70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 184 additions and 35 deletions

View file

@ -36,6 +36,7 @@ export const paramDef = {
blocked: { type: 'boolean', nullable: true },
notResponding: { type: 'boolean', nullable: true },
suspended: { type: 'boolean', nullable: true },
silenced: { type: "boolean", nullable: true },
federating: { type: 'boolean', nullable: true },
subscribing: { type: 'boolean', nullable: true },
publishing: { type: 'boolean', nullable: true },
@ -102,6 +103,23 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
if (typeof ps.silenced === "boolean") {
const meta = await this.metaService.fetch(true);
if (ps.silenced) {
if (meta.silencedHosts.length === 0) {
return [];
}
query.andWhere("instance.host IN (:...silences)", {
silences: meta.silencedHosts,
});
} else if (meta.silencedHosts.length > 0) {
query.andWhere("instance.host NOT IN (:...silences)", {
silences: meta.silencedHosts,
});
}
}
if (typeof ps.federating === 'boolean') {
if (ps.federating) {
query.andWhere('((instance.followingCount > 0) OR (instance.followersCount > 0))');