Feed in der Mitarbeiter-App (0.54.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 15m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 15m58s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 15m42s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 15m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 1h1m41s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 1h2m13s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 23m20s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 23m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 1m17s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m57s

Feed-Registry mit Anbietern (Neu im Team, Neuigkeiten, Termine, Umfragen),
Schnellaktionen je nach Rechten, Nachladen über /feed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-30 14:27:23 +00:00
parent ab76b65aff
commit 8acc0cfd8b
152 changed files with 950 additions and 361 deletions

View file

@ -5,6 +5,7 @@ namespace Inhaus\Plugins\Umfragen;
use App\Dashboard\Widgets;
use App\Digest\Digest;
use App\Editorial\Editorial;
use App\Feed\Feed;
use App\Models\User;
use App\Pagebuilder\Blocks;
use App\Pagebuilder\BlockType;
@ -13,6 +14,7 @@ use App\Plugins\Plugin;
use App\Support\Abilities;
use App\Support\Navigation;
use App\Tasks\Tasks;
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\Schedule;
use Inhaus\Plugins\Umfragen\Models\Poll;
@ -62,6 +64,24 @@ class UmfragenPlugin extends Plugin
])->values()->all(), sort: 30);
}
// Feed: neue Umfragen
if (class_exists(Feed::class)) {
$this->app->make(Feed::class)->add('umfragen', fn (User $user, ?CarbonImmutable $before, int $limit) => Poll::query()
->open()->visibleTo($user)
->when($before, fn ($query) => $query->where('published_at', '<', $before))
->latest('published_at')->limit($limit)->get()
->map(fn (Poll $poll) => [
'id' => 'poll-'.$poll->id,
'kind' => 'poll',
'time' => $poll->published_at,
'badge' => 'Umfrage',
'title' => $poll->title,
'text' => $poll->closes_at ? 'Abstimmen bis '.$poll->closes_at->translatedFormat('l, j. F') : '',
'url' => route('polls.show', $poll),
'cta' => ['label' => $poll->hasVoted($user) ? 'Ergebnis ansehen' : 'Abstimmen', 'url' => route('polls.show', $poll)],
]));
}
// Baustein: Umfrage direkt in Seite oder Beitrag
$this->app->make(Blocks::class)->add(BlockType::make('umfragen.poll', 'Umfrage', 'vote', 'dynamic', 'umfragen::PollBlock')
->description('Eine Umfrage direkt auf der Seite beantworten lassen.')