check for whitespace in instance mutes.
This commit is contained in:
@@ -22,6 +22,7 @@ import MkButton from '@/components/MkButton.vue';
|
|||||||
import { ensureSignin } from '@/i.js';
|
import { ensureSignin } from '@/i.js';
|
||||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
import * as os from '@/os.js';
|
||||||
|
|
||||||
const $i = ensureSignin();
|
const $i = ensureSignin();
|
||||||
|
|
||||||
@@ -35,13 +36,17 @@ const domainArray = computed(() => {
|
|||||||
const changed = ref(false);
|
const changed = ref(false);
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const mutes = instanceMutes.value
|
// checks for a full line without whitespace.
|
||||||
.trim().split('\n')
|
if (!domainArray.value.every(d => /^\S+$/.test(d))) {
|
||||||
.map(el => el.toLowerCase().trim())
|
os.alert({
|
||||||
.filter(el => el);
|
type: 'error',
|
||||||
|
title: i18n.ts.invalidValue,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await misskeyApi('i/update', {
|
await misskeyApi('i/update', {
|
||||||
mutedInstances: mutes,
|
mutedInstances: domainArray.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Refresh filtered list to signal to the user how they've been saved
|
// Refresh filtered list to signal to the user how they've been saved
|
||||||
|
|||||||
Reference in New Issue
Block a user