forked from FoundKeyGang/FoundKey
Added settable config for muted instances
This commit is contained in:
parent
dad6a77645
commit
ffdbf751df
8 changed files with 127 additions and 0 deletions
|
@ -59,6 +59,7 @@ mention: "Mention"
|
||||||
mentions: "Mentions"
|
mentions: "Mentions"
|
||||||
directNotes: "Direct notes"
|
directNotes: "Direct notes"
|
||||||
importAndExport: "Import / Export"
|
importAndExport: "Import / Export"
|
||||||
|
instanceMute: "Instance Mutes"
|
||||||
import: "Import"
|
import: "Import"
|
||||||
export: "Export"
|
export: "Export"
|
||||||
files: "Files"
|
files: "Files"
|
||||||
|
@ -957,6 +958,11 @@ _wordMute:
|
||||||
soft: "Soft"
|
soft: "Soft"
|
||||||
hard: "Hard"
|
hard: "Hard"
|
||||||
mutedNotes: "Muted notes"
|
mutedNotes: "Muted notes"
|
||||||
|
_instanceMute:
|
||||||
|
instanceMuteDescription: "Will mute any notes/renotes from the listed instances, including a user replying to a user from a muted instance."
|
||||||
|
instanceMuteDescription2: "Separate with newlines"
|
||||||
|
title: "Hides notes from listed instances"
|
||||||
|
heading: "List of instances to be muted"
|
||||||
_theme:
|
_theme:
|
||||||
explore: "Explore Themes"
|
explore: "Explore Themes"
|
||||||
install: "Install a theme"
|
install: "Install a theme"
|
||||||
|
|
|
@ -588,6 +588,7 @@ smtpSecure: "SMTP 接続に暗黙的なSSL/TLSを使用する"
|
||||||
smtpSecureInfo: "STARTTLS使用時はオフにします。"
|
smtpSecureInfo: "STARTTLS使用時はオフにします。"
|
||||||
testEmail: "配信テスト"
|
testEmail: "配信テスト"
|
||||||
wordMute: "ワードミュート"
|
wordMute: "ワードミュート"
|
||||||
|
instanceMute: "Instance Mutes"
|
||||||
userSaysSomething: "{name}が何かを言いました"
|
userSaysSomething: "{name}が何かを言いました"
|
||||||
makeActive: "アクティブにする"
|
makeActive: "アクティブにする"
|
||||||
display: "表示"
|
display: "表示"
|
||||||
|
@ -976,6 +977,12 @@ _wordMute:
|
||||||
hard: "ハード"
|
hard: "ハード"
|
||||||
mutedNotes: "ミュートされたノート"
|
mutedNotes: "ミュートされたノート"
|
||||||
|
|
||||||
|
_instanceMute:
|
||||||
|
instanceMuteDescription: "Will mute any notes/renotes from the listed instances, including a user replying to a user from a muted instance."
|
||||||
|
instanceMuteDescription2: "Separate with newlines"
|
||||||
|
title: "Hides notes from listed instances"
|
||||||
|
heading: "List of instances to be muted"
|
||||||
|
|
||||||
_theme:
|
_theme:
|
||||||
explore: "テーマを探す"
|
explore: "テーマを探す"
|
||||||
install: "テーマのインストール"
|
install: "テーマのインストール"
|
||||||
|
|
15
migration/1629968054000_userInstanceBlocks.ts
Normal file
15
migration/1629968054000_userInstanceBlocks.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||||
|
|
||||||
|
export class userInstanceBlocks1629968054000 implements MigrationInterface {
|
||||||
|
name = 'userInstanceBlocks1629968054000'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "user_profile" ADD "mutedInstances" jsonb NOT NULL DEFAULT '[]'`);
|
||||||
|
await queryRunner.query(`COMMENT ON COLUMN "user_profile"."mutedInstances" IS 'List of instances muted by the user.'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "mutedInstances"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -35,6 +35,7 @@
|
||||||
<FormLink :active="page === 'import-export'" replace to="/settings/import-export"><template #icon><i class="fas fa-boxes"></i></template>{{ $ts.importAndExport }}</FormLink>
|
<FormLink :active="page === 'import-export'" replace to="/settings/import-export"><template #icon><i class="fas fa-boxes"></i></template>{{ $ts.importAndExport }}</FormLink>
|
||||||
<FormLink :active="page === 'mute-block'" replace to="/settings/mute-block"><template #icon><i class="fas fa-ban"></i></template>{{ $ts.muteAndBlock }}</FormLink>
|
<FormLink :active="page === 'mute-block'" replace to="/settings/mute-block"><template #icon><i class="fas fa-ban"></i></template>{{ $ts.muteAndBlock }}</FormLink>
|
||||||
<FormLink :active="page === 'word-mute'" replace to="/settings/word-mute"><template #icon><i class="fas fa-comment-slash"></i></template>{{ $ts.wordMute }}</FormLink>
|
<FormLink :active="page === 'word-mute'" replace to="/settings/word-mute"><template #icon><i class="fas fa-comment-slash"></i></template>{{ $ts.wordMute }}</FormLink>
|
||||||
|
<FormLink :active="page === 'instance-mute'" replace to="/settings/instance-mute"><template #icon><i class="fas fa-volume-mute"></i></template>{{ $ts.instanceMute }}</FormLink>
|
||||||
<FormLink :active="page === 'api'" replace to="/settings/api"><template #icon><i class="fas fa-key"></i></template>API</FormLink>
|
<FormLink :active="page === 'api'" replace to="/settings/api"><template #icon><i class="fas fa-key"></i></template>API</FormLink>
|
||||||
<FormLink :active="page === 'other'" replace to="/settings/other"><template #icon><i class="fas fa-ellipsis-h"></i></template>{{ $ts.other }}</FormLink>
|
<FormLink :active="page === 'other'" replace to="/settings/other"><template #icon><i class="fas fa-ellipsis-h"></i></template>{{ $ts.other }}</FormLink>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
@ -108,6 +109,7 @@ export default defineComponent({
|
||||||
case 'notifications': return defineAsyncComponent(() => import('./notifications.vue'));
|
case 'notifications': return defineAsyncComponent(() => import('./notifications.vue'));
|
||||||
case 'mute-block': return defineAsyncComponent(() => import('./mute-block.vue'));
|
case 'mute-block': return defineAsyncComponent(() => import('./mute-block.vue'));
|
||||||
case 'word-mute': return defineAsyncComponent(() => import('./word-mute.vue'));
|
case 'word-mute': return defineAsyncComponent(() => import('./word-mute.vue'));
|
||||||
|
case 'instance-mute': return defineAsyncComponent(() => import('./instance-mute.vue'));
|
||||||
case 'integration': return defineAsyncComponent(() => import('./integration.vue'));
|
case 'integration': return defineAsyncComponent(() => import('./integration.vue'));
|
||||||
case 'security': return defineAsyncComponent(() => import('./security.vue'));
|
case 'security': return defineAsyncComponent(() => import('./security.vue'));
|
||||||
case '2fa': return defineAsyncComponent(() => import('./2fa.vue'));
|
case '2fa': return defineAsyncComponent(() => import('./2fa.vue'));
|
||||||
|
|
82
src/client/pages/settings/instance-mute.vue
Normal file
82
src/client/pages/settings/instance-mute.vue
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<FormBase>
|
||||||
|
<div class="_formItem">
|
||||||
|
<FormInfo>{{ $ts._instanceMute.title}}</FormInfo>
|
||||||
|
<FormTextarea v-model:value="instanceMutes">
|
||||||
|
<span>{{$ts._instanceMute.heading}}</span>
|
||||||
|
<template #desc>{{ $ts._instanceMute.instanceMuteDescription}}<br>{{$ts._instanceMute.instanceMuteDescription2}}</template>
|
||||||
|
</FormTextarea>
|
||||||
|
</div>
|
||||||
|
<FormButton @click="save()" primary inline :disabled="!changed"><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
||||||
|
</FormBase>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { defineComponent } from 'vue'
|
||||||
|
import FormBase from '@client/components/form/base.vue';
|
||||||
|
import FormTextarea from '@client/components/form/textarea.vue';
|
||||||
|
import FormInfo from '@client/components/form/info.vue';
|
||||||
|
import FormKeyValueView from '@client/components/form/key-value-view.vue';
|
||||||
|
import FormButton from '@client/components/form/button.vue';
|
||||||
|
import * as os from '@client/os';
|
||||||
|
import number from '@client/filters/number';
|
||||||
|
import * as symbols from '@client/symbols';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
components: {
|
||||||
|
FormBase,
|
||||||
|
FormButton,
|
||||||
|
FormTextarea,
|
||||||
|
FormKeyValueView,
|
||||||
|
FormInfo,
|
||||||
|
},
|
||||||
|
|
||||||
|
emits: ['info'],
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
[symbols.PAGE_INFO]: {
|
||||||
|
title: this.$ts.instanceMute,
|
||||||
|
icon: 'fas fa-volume-mute'
|
||||||
|
},
|
||||||
|
tab: 'soft',
|
||||||
|
instanceMutes: '',
|
||||||
|
changed: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
instanceMutes: {
|
||||||
|
handler() {
|
||||||
|
this.changed = true;
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
async created() {
|
||||||
|
console.log(this.$i);
|
||||||
|
this.instanceMutes = this.$i.mutedInstances.join('\n');
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async save() {
|
||||||
|
let mutes = this.instanceMutes.trim().split('\n');
|
||||||
|
console.log(mutes);
|
||||||
|
await os.api('i/update', {
|
||||||
|
mutedInstances: mutes,
|
||||||
|
});
|
||||||
|
this.changed = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
number //?
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -178,6 +178,11 @@ export class UserProfile {
|
||||||
})
|
})
|
||||||
public mutedWords: string[][];
|
public mutedWords: string[][];
|
||||||
|
|
||||||
|
@Column('jsonb', {
|
||||||
|
default: []
|
||||||
|
})
|
||||||
|
public mutedInstances: string[];
|
||||||
|
|
||||||
@Column('enum', {
|
@Column('enum', {
|
||||||
enum: notificationTypes,
|
enum: notificationTypes,
|
||||||
array: true,
|
array: true,
|
||||||
|
|
|
@ -270,6 +270,7 @@ export class UserRepository extends Repository<User> {
|
||||||
hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id),
|
hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id),
|
||||||
integrations: profile!.integrations,
|
integrations: profile!.integrations,
|
||||||
mutedWords: profile!.mutedWords,
|
mutedWords: profile!.mutedWords,
|
||||||
|
mutedInstances: profile!.mutedInstances,
|
||||||
mutingNotificationTypes: profile!.mutingNotificationTypes,
|
mutingNotificationTypes: profile!.mutingNotificationTypes,
|
||||||
emailNotificationTypes: profile!.emailNotificationTypes,
|
emailNotificationTypes: profile!.emailNotificationTypes,
|
||||||
} : {}),
|
} : {}),
|
||||||
|
@ -617,6 +618,10 @@ export const packedUserSchema = {
|
||||||
type: 'array' as const,
|
type: 'array' as const,
|
||||||
nullable: false as const, optional: true as const
|
nullable: false as const, optional: true as const
|
||||||
},
|
},
|
||||||
|
mutedInstances: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const
|
||||||
|
},
|
||||||
mutingNotificationTypes: {
|
mutingNotificationTypes: {
|
||||||
type: 'array' as const,
|
type: 'array' as const,
|
||||||
nullable: false as const, optional: true as const
|
nullable: false as const, optional: true as const
|
||||||
|
|
|
@ -108,6 +108,10 @@ export const meta = {
|
||||||
validator: $.optional.arr($.arr($.str))
|
validator: $.optional.arr($.arr($.str))
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mutedInstances: {
|
||||||
|
validator: $.optional.arr($.str)
|
||||||
|
},
|
||||||
|
|
||||||
mutingNotificationTypes: {
|
mutingNotificationTypes: {
|
||||||
validator: $.optional.arr($.str.or(notificationTypes as unknown as string[]))
|
validator: $.optional.arr($.str.or(notificationTypes as unknown as string[]))
|
||||||
},
|
},
|
||||||
|
@ -176,6 +180,7 @@ export default define(meta, async (ps, _user, token) => {
|
||||||
profileUpdates.mutedWords = ps.mutedWords;
|
profileUpdates.mutedWords = ps.mutedWords;
|
||||||
profileUpdates.enableWordMute = ps.mutedWords.length > 0;
|
profileUpdates.enableWordMute = ps.mutedWords.length > 0;
|
||||||
}
|
}
|
||||||
|
if (ps.mutedInstances !== undefined) profileUpdates.mutedInstances = ps.mutedInstances;
|
||||||
if (ps.mutingNotificationTypes !== undefined) profileUpdates.mutingNotificationTypes = ps.mutingNotificationTypes as typeof notificationTypes[number][];
|
if (ps.mutingNotificationTypes !== undefined) profileUpdates.mutingNotificationTypes = ps.mutingNotificationTypes as typeof notificationTypes[number][];
|
||||||
if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked;
|
if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked;
|
||||||
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;
|
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;
|
||||||
|
|
Loading…
Reference in a new issue