diff --git a/CHANGELOG.md b/CHANGELOG.md index f2b3ad29..69340a16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Neueste Version oben. Jeder Abschnitt beginnt mit `## MAJOR.MINOR.PATCH` und enthält kurze Stichpunkte für Anwenderinnen und Anwender – keine Commit-Texte. Der Self-Updater zeigt diese Abschnitte bei neuen Versionen an. +## 0.17.0 + +- **Kommentare unter Neuigkeiten:** Alle, die einen Beitrag sehen dürfen, können kommentieren und auf Kommentare antworten (Antworten erscheinen eingerückt, „Antwort an …“). Eigene Kommentare lassen sich bearbeiten und löschen, die Redaktion (Recht „Kommentare anderer löschen“) moderiert. Die Autorin bzw. der Autor erfährt von neuen Kommentaren, wer kommentiert hat, von Antworten. Im Beitragskopf steht die Anzahl, im Editor lassen sich Kommentare je Beitrag abschalten + ## 0.16.0 - **Neues Plugin „IT-Service (OpenNIT)“** (zunächst abgeschaltet, Menüpunkt „IT-Service“): IT-Self-Service über die OpenNIT-API diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index 7cb20982..fd6c5000 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -42,6 +42,7 @@ class HandleInertiaRequests extends Middleware 'notifications' => fn () => $user ? ['unread' => $user->unreadNotifications()->count()] : null, 'flash' => [ 'status' => fn () => $request->session()->get('status'), + 'comment' => fn () => $request->session()->get('comment'), 'form_submitted' => fn () => $request->session()->get('form_submitted'), ], ]; diff --git a/app/Version.php b/app/Version.php index 31af9903..04a6d9b8 100644 --- a/app/Version.php +++ b/app/Version.php @@ -9,5 +9,5 @@ namespace App; */ final class Version { - public const VERSION = '0.16.0'; + public const VERSION = '0.17.0'; } diff --git a/plugins-core/news/database/migrations/2026_10_06_000001_create_news_comments.php b/plugins-core/news/database/migrations/2026_10_06_000001_create_news_comments.php new file mode 100644 index 00000000..91a4fbeb --- /dev/null +++ b/plugins-core/news/database/migrations/2026_10_06_000001_create_news_comments.php @@ -0,0 +1,40 @@ +id(); + $table->foreignId('post_id')->constrained('news_posts')->cascadeOnDelete(); + $table->foreignId('parent_id')->nullable()->constrained('news_comments')->cascadeOnDelete(); + $table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete(); + $table->foreignId('reply_to_user_id')->nullable()->constrained('users')->nullOnDelete(); + $table->text('body'); + $table->timestamp('edited_at')->nullable(); + $table->timestamps(); + $table->softDeletes(); + $table->index(['post_id', 'parent_id', 'created_at']); + }); + + if (! Schema::hasColumn('news_posts', 'comments_enabled')) { + Schema::table('news_posts', fn (Blueprint $table) => $table->boolean('comments_enabled')->default(true)->after('form_id')); + } + } + + public function down(): void + { + Schema::dropIfExists('news_comments'); + + if (Schema::hasColumn('news_posts', 'comments_enabled')) { + Schema::table('news_posts', fn (Blueprint $table) => $table->dropColumn('comments_enabled')); + } + } +}; diff --git a/plugins-core/news/resources/js/components/NewsComments.vue b/plugins-core/news/resources/js/components/NewsComments.vue new file mode 100644 index 00000000..5223b43f --- /dev/null +++ b/plugins-core/news/resources/js/components/NewsComments.vue @@ -0,0 +1,215 @@ + + +