Ideenbox-Moderation und Wochenüberblick per E-Mail (0.36.0)
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 6m49s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m19s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m29s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 7m39s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 9m38s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m25s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 7m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m4s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 46s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m9s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 6m49s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m19s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m29s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 7m39s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 9m38s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m25s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 7m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m4s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 46s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m9s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
11c5ef5baf
commit
f9922f7308
172 changed files with 1524 additions and 363 deletions
|
|
@ -0,0 +1,37 @@
|
|||
<script setup>
|
||||
import { router } from '@inertiajs/vue3';
|
||||
import { Flag } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
/**
|
||||
* Für das Gremium: offene Meldungen zu einer Idee oder einem Kommentar – behalten oder löschen.
|
||||
*/
|
||||
const props = defineProps({
|
||||
ideaId: { type: Number, required: true },
|
||||
commentId: { type: Number, default: null },
|
||||
reports: { type: Array, required: true },
|
||||
hidden: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
function decide(action) {
|
||||
if (action === 'remove' && !window.confirm(props.commentId ? 'Kommentar löschen?' : 'Idee samt Kommentaren löschen?')) return;
|
||||
|
||||
router.put(`/ideen/${props.ideaId}/meldungen`, { comment_id: props.commentId, action }, { preserveScroll: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm" role="status">
|
||||
<p class="flex items-center gap-2 font-medium">
|
||||
<Flag class="size-4 text-destructive" />
|
||||
{{ reports.length }} {{ reports.length === 1 ? 'Meldung' : 'Meldungen' }}<template v-if="hidden"> · vorläufig ausgeblendet</template>
|
||||
</p>
|
||||
<ul class="mt-1.5 grid gap-0.5 pl-6 text-[13px] text-muted-foreground">
|
||||
<li v-for="(report, i) in reports" :key="i">{{ report.reason }}<template v-if="report.note">: „{{ report.note }}“</template></li>
|
||||
</ul>
|
||||
<div class="mt-3 flex flex-wrap gap-2 pl-6">
|
||||
<Button size="sm" variant="outline" @click="decide('keep')">In Ordnung – behalten</Button>
|
||||
<Button size="sm" variant="outline" class="text-destructive hover:text-destructive" @click="decide('remove')">Löschen</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
63
plugins-core/ideen/resources/js/components/ReportDialog.vue
Normal file
63
plugins-core/ideen/resources/js/components/ReportDialog.vue
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<script setup>
|
||||
import { watch } from 'vue';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { LoaderCircle } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
|
||||
/**
|
||||
* Idee oder Kommentar melden. Das Gremium sieht Grund und Anmerkung, nicht den Namen.
|
||||
*/
|
||||
const props = defineProps({
|
||||
ideaId: { type: Number, required: true },
|
||||
commentId: { type: Number, default: null },
|
||||
reasons: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const open = defineModel('open', { type: Boolean, default: false });
|
||||
const form = useForm({ reason: '', note: '', comment_id: null });
|
||||
|
||||
watch(open, (value) => {
|
||||
if (!value) return;
|
||||
|
||||
form.reset();
|
||||
form.clearErrors();
|
||||
form.comment_id = props.commentId;
|
||||
});
|
||||
|
||||
function submit() {
|
||||
form.post(`/ideen/${props.ideaId}/melden`, { preserveScroll: true, onSuccess: () => (open.value = false) });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog v-model:open="open">
|
||||
<DialogContent class="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ commentId ? 'Kommentar melden' : 'Idee melden' }}</DialogTitle>
|
||||
<DialogDescription>Das Gremium prüft den Hinweis. Ihr Name wird dabei nicht angezeigt.</DialogDescription>
|
||||
</DialogHeader>
|
||||
<form id="report-form" class="grid gap-4" @submit.prevent="submit">
|
||||
<fieldset class="grid gap-2">
|
||||
<legend class="mb-2 text-sm font-medium">Warum?</legend>
|
||||
<label v-for="(label, key) in reasons" :key="key" class="flex cursor-pointer items-center gap-3 rounded-md border px-3 py-2 text-sm hover:bg-accent/50 has-[:checked]:border-brand has-[:checked]:bg-brand-soft">
|
||||
<input v-model="form.reason" type="radio" name="reason" :value="key" class="size-4 accent-[var(--color-brand)]" />
|
||||
{{ label }}
|
||||
</label>
|
||||
</fieldset>
|
||||
<div class="grid gap-1.5">
|
||||
<label for="report-note" class="text-sm font-medium">Anmerkung (optional)</label>
|
||||
<Textarea id="report-note" v-model="form.note" rows="2" maxlength="500" />
|
||||
</div>
|
||||
<p v-if="form.errors.reason" class="text-[13px] text-destructive">Bitte einen Grund auswählen.</p>
|
||||
</form>
|
||||
<DialogFooter>
|
||||
<Button variant="ghost" @click="open = false">Abbrechen</Button>
|
||||
<Button type="submit" form="report-form" :disabled="form.processing || !form.reason">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" /> Melden
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
|
@ -1,17 +1,28 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { MessageCircle, ThumbsUp } from '@lucide/vue';
|
||||
import { EyeOff, Flag, MessageCircle, ThumbsUp } from '@lucide/vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import { formatRelative } from '@/lib/format';
|
||||
import StatusBadge from '../components/StatusBadge.vue';
|
||||
|
||||
defineProps({
|
||||
ideas: { type: Array, required: true },
|
||||
reported: { type: Array, default: () => [] },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Panel title="Ideenbox – zu sichten" action-label="Alle Ideen" action-href="/ideen">
|
||||
<template v-if="reported.length">
|
||||
<h3 class="mb-2 flex items-center gap-1.5 text-xs font-semibold tracking-wider text-destructive uppercase"><Flag class="size-3.5" /> Gemeldet</h3>
|
||||
<ul class="-mx-5 mb-5 divide-y border-y">
|
||||
<li v-for="idea in reported" :key="idea.id" class="flex items-center gap-3 px-5 py-2.5">
|
||||
<Link :href="idea.url" class="min-w-0 flex-1 truncate text-sm font-medium hover:underline">{{ idea.title }}</Link>
|
||||
<EyeOff v-if="idea.hidden" class="size-3.5 shrink-0 text-muted-foreground" title="Vorläufig ausgeblendet" />
|
||||
<span class="shrink-0 text-xs text-destructive tabular-nums">{{ idea.reports }} {{ idea.reports === 1 ? 'Meldung' : 'Meldungen' }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<ul v-if="ideas.length" class="-mx-5 divide-y border-t">
|
||||
<li v-for="idea in ideas" :key="idea.id" class="flex items-center gap-3 px-5 py-2.5">
|
||||
<div class="min-w-0 flex-1">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { Link, router, useForm, usePage } from '@inertiajs/vue3';
|
||||
import { BadgeCheck, LoaderCircle, PencilLine, Trash2 } from '@lucide/vue';
|
||||
import { BadgeCheck, EyeOff, Flag, LoaderCircle, PencilLine, Trash2 } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
|
|
@ -13,14 +13,25 @@ import PersonAvatar from '@/components/PersonAvatar.vue';
|
|||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { formatDate, formatRelative } from '@/lib/format';
|
||||
import IdeaDialog from '../components/IdeaDialog.vue';
|
||||
import ModerationNotice from '../components/ModerationNotice.vue';
|
||||
import ReportDialog from '../components/ReportDialog.vue';
|
||||
import StatusBadge from '../components/StatusBadge.vue';
|
||||
import SupportButton from '../components/SupportButton.vue';
|
||||
|
||||
const props = defineProps({
|
||||
idea: { type: Object, required: true },
|
||||
statuses: { type: Object, required: true },
|
||||
reasons: { type: Object, required: true },
|
||||
});
|
||||
|
||||
// Melden
|
||||
const reporting = ref(false);
|
||||
const reportComment = ref(null);
|
||||
function report(commentId = null) {
|
||||
reportComment.value = commentId;
|
||||
reporting.value = true;
|
||||
}
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
|
|
@ -55,14 +66,19 @@ function remove() {
|
|||
eingereicht {{ formatRelative(idea.created_at) }}<template v-if="!idea.author"> · anonym</template>
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="idea.can_edit || idea.can_manage" #actions>
|
||||
<template #actions>
|
||||
<Button v-if="idea.can_edit" variant="outline" size="sm" @click="editing = true"><PencilLine /> Bearbeiten</Button>
|
||||
<Button variant="ghost" size="sm" class="text-destructive hover:text-destructive" @click="remove"><Trash2 /> Löschen</Button>
|
||||
<Button v-if="idea.can_edit || idea.can_manage" variant="ghost" size="sm" class="text-destructive hover:text-destructive" @click="remove"><Trash2 /> Löschen</Button>
|
||||
<Button v-if="!idea.mine && !idea.can_manage" variant="ghost" size="sm" class="text-muted-foreground" :disabled="idea.reported" @click="report()">
|
||||
<Flag /> {{ idea.reported ? 'Gemeldet' : 'Melden' }}
|
||||
</Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div class="grid items-start gap-6 lg:grid-cols-12">
|
||||
<div class="grid min-w-0 gap-6 lg:col-span-8">
|
||||
<ModerationNotice v-if="idea.can_manage && idea.reports.length" :idea-id="idea.id" :reports="idea.reports" :hidden="idea.hidden" />
|
||||
<p v-else-if="idea.hidden" class="flex items-center gap-2 rounded-md border bg-muted/60 p-3 text-sm"><EyeOff class="size-4 shrink-0" /> Ihre Idee ist vorläufig ausgeblendet, weil sie gemeldet wurde. Das Gremium prüft sie.</p>
|
||||
<Panel>
|
||||
<div class="flex gap-5">
|
||||
<SupportButton :idea="idea" :disabled="idea.mine" large />
|
||||
|
|
@ -85,7 +101,7 @@ function remove() {
|
|||
|
||||
<Panel id="kommentare" :title="`Kommentare (${idea.comment_list.length})`">
|
||||
<ul v-if="idea.comment_list.length" class="-mx-5 mb-5 divide-y border-y">
|
||||
<li v-for="c in idea.comment_list" :key="c.id" class="flex gap-3 px-5 py-4" :class="{ 'bg-brand-soft/40': c.official }">
|
||||
<li v-for="c in idea.comment_list" :id="`kommentar-${c.id}`" :key="c.id" class="flex gap-3 px-5 py-4" :class="{ 'bg-brand-soft/40': c.official }">
|
||||
<PersonAvatar v-if="c.author" :person="c.author" class="size-9" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="flex flex-wrap items-center gap-x-2 text-sm">
|
||||
|
|
@ -93,8 +109,20 @@ function remove() {
|
|||
<span v-if="c.official" class="inline-flex items-center gap-1 text-xs font-medium text-brand-text"><BadgeCheck class="size-3.5" /> Gremium</span>
|
||||
<span class="text-xs text-muted-foreground">{{ formatRelative(c.created_at) }}</span>
|
||||
</p>
|
||||
<p class="mt-1 text-sm leading-relaxed whitespace-pre-line">{{ c.body }}</p>
|
||||
<p v-if="c.body === null" class="mt-1 flex items-center gap-1.5 text-sm text-muted-foreground italic"><EyeOff class="size-3.5" /> Vorläufig ausgeblendet – wird geprüft.</p>
|
||||
<p v-else class="mt-1 text-sm leading-relaxed whitespace-pre-line" :class="{ 'opacity-60': c.hidden }">{{ c.body }}</p>
|
||||
<ModerationNotice v-if="idea.can_manage && c.reports.length" :idea-id="idea.id" :comment-id="c.id" :reports="c.reports" :hidden="c.hidden" class="mt-2" />
|
||||
</div>
|
||||
<Button
|
||||
v-if="!c.can_delete && c.body !== null"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="size-7 shrink-0 text-muted-foreground"
|
||||
:disabled="c.reported"
|
||||
:aria-label="c.reported ? 'Bereits gemeldet' : 'Kommentar melden'"
|
||||
:title="c.reported ? 'Bereits gemeldet' : 'Kommentar melden'"
|
||||
@click="report(c.id)"
|
||||
><Flag class="size-3.5" /></Button>
|
||||
<Button v-if="c.can_delete" variant="ghost" size="icon" class="size-7 shrink-0 text-muted-foreground hover:text-destructive" aria-label="Kommentar löschen" @click="deleteComment(c)"><Trash2 class="size-3.5" /></Button>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -138,5 +166,6 @@ function remove() {
|
|||
</div>
|
||||
|
||||
<IdeaDialog v-if="idea.can_edit" v-model:open="editing" :idea="idea" />
|
||||
<ReportDialog v-model:open="reporting" :idea-id="idea.id" :comment-id="reportComment" :reasons="reasons" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue