Halte deaktivierte Bestandteile im Aufbau, damit die Freigabe sie anzeigt.
Deploy Test / test (push) Failing after 9s
Deploy Test / deploy (push) Skipped

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-17 13:34:38 +01:00
1 parent d12ba67b45
commit dd67741f35
7 files changed
+93 -26

No files matched your search

@@ -676,7 +676,7 @@ public function childrenOf(string $target): string
continue;
}
$row = app(EditorialCatalog::class)->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true);
$row = app(EditorialCatalog::class)->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true, allowBlocked: true);
$lines[] = trim((string) ($member['role'] ?? '')).': '.($row['title'] ?? 'Bestandteil');
}
@@ -1622,7 +1622,7 @@ protected function applyDraft(array $draft): void
}
$requested++;
$row = $catalog->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true);
$row = $catalog->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true, allowBlocked: true);
if ($row === null) {
continue;
@@ -281,11 +281,22 @@ protected function getHeaderActions(): array
->modalHeading('Fassung freigeben')
->modalDescription('Diese Fassung wird freigegeben. Sie erscheint dadurch nicht in der Mitgliederbibliothek, nicht auf der Website und nicht in einem Angebot. Eine deaktivierte Fassung bleibt unverändert.')
->modalSubmitActionLabel('Freigeben')
->visible(fn (): bool => ContentElementResource::editor())
->visible(function (): bool {
/** @var ContentElement $element */
$element = $this->getRecord();
return ContentElementResource::editor()
&& $element->versions()->where('status', ContentVersionStatus::Entwurf)->exists();
})
->action(function (array $arguments): void {
abort_unless(ContentElementResource::editor(), 403);
$this->report(function () use ($arguments): string {
$version = $this->ownedVersion((int) ($arguments['version'] ?? 0));
/** @var ContentElement $element */
$element = $this->getRecord();
$versionId = (int) ($arguments['version'] ?? 0);
$version = $versionId > 0
? $this->ownedVersion($versionId)
: $element->versions()->where('status', ContentVersionStatus::Entwurf)->orderByDesc('number')->first();
abort_unless($version instanceof ContentElementVersion, 404);
$released = app(ContentService::class)->releaseElementVersion($version);
+21 -5
View File
@@ -40,7 +40,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
$target = $member->content_element_version_id
? 'element:'.$member->content_element_version_id
: 'composition:'.$member->nested_composition_version_id;
$row = $this->rowForTarget($target, $exceptCompositionId, allowSelf: true, allowDraft: true);
$row = $this->rowForTarget($target, $exceptCompositionId, allowSelf: true, allowDraft: true, allowBlocked: true);
if ($row === null) {
continue;
@@ -57,7 +57,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
/**
* @return array<string, string|null>|null
*/
public function rowForTarget(string $target, int $exceptCompositionId, bool $allowSelf = false, bool $allowDraft = false): ?array
public function rowForTarget(string $target, int $exceptCompositionId, bool $allowSelf = false, bool $allowDraft = false, bool $allowBlocked = false): ?array
{
if (preg_match('/^composition-draft:(\d+)$/', $target, $draftMatch) === 1) {
return $this->draftCompositionRow((int) $draftMatch[1], $exceptCompositionId, $allowSelf);
@@ -77,6 +77,10 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
$acceptable[] = ContentVersionStatus::Entwurf;
}
if ($allowBlocked) {
$acceptable[] = ContentVersionStatus::Gesperrt;
}
if (! $version instanceof ContentElementVersion || ! in_array($version->status, $acceptable, true)) {
return null;
}
@@ -98,7 +102,11 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
'license_note' => (string) ($element->license_note ?? ''),
'tone' => $this->tone((string) $element->output_class, $kind),
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path),
'version_label' => $version->status === ContentVersionStatus::Entwurf ? 'Entwurf' : 'Fassung '.$version->number,
'version_label' => match ($version->status) {
ContentVersionStatus::Entwurf => 'Entwurf',
ContentVersionStatus::Gesperrt => 'deaktiviert',
default => 'Fassung '.$version->number,
},
'committed' => app(ContentService::class)->isCommitted($version),
'identity' => 'medium:'.$element->id,
'open_url' => route('content.preview', $version),
@@ -111,7 +119,13 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
->with('composition.editorialContentKind')
->find($match[2]);
if (! $version instanceof CompositionVersion || $version->status !== ContentVersionStatus::Bereit) {
$acceptable = [ContentVersionStatus::Bereit];
if ($allowBlocked) {
$acceptable[] = ContentVersionStatus::Gesperrt;
}
if (! $version instanceof CompositionVersion || ! in_array($version->status, $acceptable, true)) {
return null;
}
@@ -130,7 +144,9 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
'summary' => (string) ($composition->summary ?? ''),
'tone' => $this->tone('', $kind),
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path),
'version_label' => 'Fassung '.$version->number,
'version_label' => $version->status === ContentVersionStatus::Gesperrt
? 'deaktiviert'
: 'Fassung '.$version->number,
'identity' => 'zusammenstellung:'.$composition->id,
'open_url' => route('editorial.preview', ['composition' => $composition, 'version' => $version]),
'open_label' => 'Aufbau ansehen',