mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
check for whitespace in instance mutes.
This commit is contained in:
parent
c6e702c070
commit
77f0ba0ddf
1 changed files with 10 additions and 5 deletions
|
@ -22,6 +22,7 @@ import MkButton from '@/components/MkButton.vue';
|
|||
import { ensureSignin } from '@/i.js';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import * as os from '@/os.js';
|
||||
|
||||
const $i = ensureSignin();
|
||||
|
||||
|
@ -35,13 +36,17 @@ const domainArray = computed(() => {
|
|||
const changed = ref(false);
|
||||
|
||||
async function save() {
|
||||
const mutes = instanceMutes.value
|
||||
.trim().split('\n')
|
||||
.map(el => el.toLowerCase().trim())
|
||||
.filter(el => el);
|
||||
// checks for a full line without whitespace.
|
||||
if (!domainArray.value.every(d => /^\S+$/.test(d))) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
title: i18n.ts.invalidValue,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await misskeyApi('i/update', {
|
||||
mutedInstances: mutes,
|
||||
mutedInstances: domainArray.value,
|
||||
});
|
||||
|
||||
// Refresh filtered list to signal to the user how they've been saved
|
||||
|
|
Loading…
Add table
Reference in a new issue