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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-27 15:17:47 +00:00
parent 11c5ef5baf
commit f9922f7308
172 changed files with 1524 additions and 363 deletions

View file

@ -6,6 +6,7 @@ use App\Models\User;
use Illuminate\Support\Str;
use Inhaus\Plugins\Ideen\Models\Idea;
use Inhaus\Plugins\Ideen\Models\IdeaComment;
use Inhaus\Plugins\Ideen\Models\IdeaReport;
class Presenter
{
@ -35,6 +36,11 @@ class Presenter
public static function detail(Idea $idea, User $user): array
{
$manager = $user->can('ideas.manage');
$reports = IdeaReport::query()->where('idea_id', $idea->id)->get();
$mineReported = $reports->where('user_id', $user->id)->map(fn ($r) => $r->comment_id ?? 0)->all();
// Für das Gremium: offene Meldungen je Inhalt – Gründe und Anmerkungen, ohne Namen der Meldenden
$open = fn (?int $commentId) => $manager ? $reports->whereNull('resolved_at')->where('comment_id', $commentId)->values()
->map(fn (IdeaReport $r) => ['reason' => IdeaReport::REASONS[$r->reason] ?? $r->reason, 'note' => $r->note])->all() : [];
return [
...self::card($idea, $idea->supporters()->whereKey($user->id)->exists()),
@ -45,10 +51,17 @@ class Presenter
'mine' => ! $idea->anonymous && $idea->author_id === $user->id,
'can_edit' => ! $idea->anonymous && $idea->author_id === $user->id && $idea->status === 'new',
'can_manage' => $manager,
'hidden' => $idea->hidden_at !== null,
'reported' => in_array(0, $mineReported, true),
'reports' => $open(null),
'comment_list' => $idea->comments()->with('user')->oldest()->oldest('id')->limit(500)->get()
->map(fn (IdeaComment $c) => [
'id' => $c->id,
'body' => $c->body,
// Ausgeblendet: nur Gremium und die schreibende Person sehen den Text
'body' => $c->hidden_at && ! $manager && $c->user_id !== $user->id ? null : $c->body,
'hidden' => $c->hidden_at !== null,
'reported' => in_array($c->id, $mineReported, true),
'reports' => $open($c->id),
'official' => $c->official,
'created_at' => $c->created_at?->toIso8601String(),
'author' => $c->user ? ['id' => $c->user->id, 'name' => $c->user->name, 'initials' => $c->user->initials, 'avatar_url' => $c->user->avatarUrl(64)] : null,