Skip to content

Commit 8e9a27e

Browse files
committed
Merge branch 'main' into develop
2 parents 9e81c85 + 69243a0 commit 8e9a27e

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
88

9+
* [PR-548](https://github.com/itk-dev/deltag.aarhus.dk/pull/548)
10+
5479: Fixed handling of draft citizen proposals
11+
912
## [4.13.0] - 2025-09-02
1013

1114
* [PR-545](https://github.com/itk-dev/deltag.aarhus.dk/pull/545)

web/modules/custom/hoeringsportal_citizen_proposal/hoeringsportal_citizen_proposal.services.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ services:
1111
Drupal\hoeringsportal_citizen_proposal\Helper\Helper:
1212
arguments:
1313
- "@tempstore.private"
14-
- "@serializer"
1514
- "@state"
1615
- "@file_url_generator"
1716
- "@current_route_match"

web/modules/custom/hoeringsportal_citizen_proposal/src/Helper/Helper.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Psr\Log\LoggerAwareInterface;
2626
use Psr\Log\LoggerAwareTrait;
2727
use Psr\Log\LoggerTrait;
28-
use Symfony\Component\Serializer\Serializer;
2928

3029
/**
3130
* A helper class for the module.
@@ -47,7 +46,6 @@ class Helper implements LoggerAwareInterface {
4746
*/
4847
public function __construct(
4948
readonly private PrivateTempStoreFactory $tempStoreFactory,
50-
readonly private Serializer $serializer,
5149
readonly private StateInterface $state,
5250
readonly private FileUrlGenerator $fileUrlGenerator,
5351
readonly private RouteMatchInterface $routeMatch,
@@ -65,11 +63,10 @@ public function __construct(
6563
* @return object|null
6664
* The entity or NULL if no valid entity was found.
6765
*/
68-
public function getDraftProposal(): ?object {
69-
$entitySerialized = $this->getProposalStorage()->get(self::CITIZEN_PROPOSAL_ENTITY);
70-
$node = is_string($entitySerialized) ? $this->serializer->deserialize($entitySerialized, Node::class, 'json') : NULL;
66+
public function getDraftProposal(): ?NodeInterface {
67+
$entity = $this->getProposalStorage()->get(self::CITIZEN_PROPOSAL_ENTITY);
7168

72-
return isset($node) && $node instanceof Node ? $node : NULL;
69+
return $entity instanceof NodeInterface ? $entity : NULL;
7370
}
7471

7572
/**
@@ -93,11 +90,10 @@ public function deleteDraftProposal(): void {
9390
/**
9491
* Add entity to temp store.
9592
*/
96-
public function setDraftProposal($entity): void {
97-
$nodeSerialized = $this->serializer->serialize($entity, 'json');
93+
public function setDraftProposal(NodeInterface $entity): void {
9894
try {
9995
$this->getProposalStorage()->set(
100-
self::CITIZEN_PROPOSAL_ENTITY, $nodeSerialized
96+
self::CITIZEN_PROPOSAL_ENTITY, $entity
10197
);
10298
}
10399
catch (\Exception $exception) {
@@ -514,7 +510,7 @@ public function isActive(NodeInterface $node): bool {
514510
/**
515511
* Get vote end date.
516512
*/
517-
public function getVoteEndDate(NodeInterface $node): int {
513+
public function getVoteEndDate(NodeInterface $node): ?int {
518514
if (!$this->isCitizenProposal($node)) {
519515
return NULL;
520516
}

0 commit comments

Comments
 (0)