add "reject quotes" toggle at user and instance level

+ improve, cleanup, and de-duplicate quote resolution
+ add warning message when quote cannot be loaded
+ add "process error" framework to display warnings when a note cannot be correctly loaded from another instance
This commit is contained in:
Hazelnoot 2025-02-15 23:08:02 -05:00
parent 93ffd4611c
commit 292d3b9229
36 changed files with 466 additions and 88 deletions

View file

@ -142,7 +142,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<i class="ti ti-ban"></i>
</button>
<button
v-if="canRenote && !props.mock"
v-if="canRenote && !props.mock && !$i?.rejectQuotes"
ref="quoteButton"
:class="$style.footerButton"
class="_button"

View file

@ -153,7 +153,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<i class="ti ti-ban"></i>
</button>
<button
v-if="canRenote"
v-if="canRenote && !$i?.rejectQuotes"
ref="quoteButton"
class="_button"
:class="$style.noteFooterButton"

View file

@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<p v-if="note.renoteCount > 0" :class="$style.noteFooterButtonCount">{{ note.renoteCount }}</p>
</button>
<button
v-if="canRenote"
v-if="canRenote && !$i?.rejectQuotes"
ref="quoteButton"
class="_button"
:class="$style.noteFooterButton"

View file

@ -640,7 +640,7 @@ async function onPaste(ev: ClipboardEvent) {
const paste = ev.clipboardData.getData('text');
if (!renoteTargetNote.value && !quoteId.value && paste.startsWith(url + '/notes/')) {
if (!renoteTargetNote.value && !quoteId.value && paste.startsWith(url + '/notes/') && !$i.rejectQuotes) {
ev.preventDefault();
os.confirm({

View file

@ -0,0 +1,43 @@
<!--
SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<!-- Match appearance of MkRemoteCaution.vue -->
<div v-for="error of displayErrors" :key="error" :class="$style.root">
<i :class="$style.icon" class="ti ti-alert-triangle"></i>{{ i18n.ts._processErrors[error] ?? error }}
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { i18n } from '@/i18n.js';
const props = defineProps<{
errors?: string[] | null;
}>();
const displayErrors = computed<Iterable<string>>(() => {
if (!props.errors?.length) return [];
// Set constructor preserve order, so we can sort first to avoid a copy operation.
return new Set(props.errors.toSorted());
});
</script>
<style module lang="scss">
.root {
font-size: 0.8em;
padding: 16px;
background: color-mix(in srgb, var(--MI_THEME-infoWarnBg) 65%, transparent);
color: var(--MI_THEME-infoWarnFg);
border-radius: var(--MI-radius);
overflow: clip;
z-index: 1;
}
.icon {
margin-right: 8px;
}
</style>

View file

@ -143,7 +143,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<i class="ti ti-ban"></i>
</button>
<button
v-if="canRenote && !props.mock"
v-if="canRenote && !props.mock && !$i?.rejectQuotes"
ref="quoteButton"
:class="$style.footerButton"
class="_button"

View file

@ -158,7 +158,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<i class="ti ti-ban"></i>
</button>
<button
v-if="canRenote"
v-if="canRenote && !$i?.rejectQuotes"
ref="quoteButton"
class="_button"
:class="$style.noteFooterButton"

View file

@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<p v-if="note.renoteCount > 0" :class="$style.noteFooterButtonCount">{{ note.renoteCount }}</p>
</button>
<button
v-if="canRenote"
v-if="canRenote && !$i?.rejectQuotes"
ref="quoteButton"
class="_button"
:class="$style.noteFooterButton"