upd: add bubble to instance federation page as state

Closes #296
This commit is contained in:
Marie 2024-01-02 13:35:03 +01:00
parent 81dea75eb7
commit a1a57889fc
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828
2 changed files with 20 additions and 0 deletions

View File

@ -41,6 +41,7 @@ export const paramDef = {
subscribing: { type: 'boolean', nullable: true },
publishing: { type: 'boolean', nullable: true },
nsfw: { type: 'boolean', nullable: true },
bubble: { type: 'boolean', nullable: true },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 },
offset: { type: 'integer', default: 0 },
sort: {
@ -148,6 +149,23 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
if (typeof ps.bubble === 'boolean') {
const meta = await this.metaService.fetch(true);
if (ps.bubble) {
if (meta.bubbleInstances.length === 0) {
return [];
}
query.andWhere('instance.host IN (:...bubble)', {
silences: meta.bubbleInstances,
});
} else if (meta.bubbleInstances.length > 0) {
query.andWhere('instance.host NOT IN (:...bubble)', {
bubble: meta.bubbleInstances,
});
}
}
if (typeof ps.federating === 'boolean') {
if (ps.federating) {
query.andWhere('((instance.followingCount > 0) OR (instance.followersCount > 0))');

View File

@ -17,6 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="federating">{{ i18n.ts.federating }}</option>
<option value="subscribing">{{ i18n.ts.subscribing }}</option>
<option value="publishing">{{ i18n.ts.publishing }}</option>
<option value="bubble">Bubble</option>
<option value="nsfw">NSFW</option>
<option value="suspended">{{ i18n.ts.suspended }}</option>
<option value="silenced">{{ i18n.ts.silence }}</option>
@ -80,6 +81,7 @@ const pagination = {
state.value === 'silenced' ? { silenced: true } :
state.value === 'notResponding' ? { notResponding: true } :
state.value === 'nsfw' ? { nsfw: true } :
state.value === 'bubble' ? { nsfw: true } :
{}),
})),
} as Paging;