Skip to content

Commit

Permalink
Merge branch 'craft-4' of https://github.com/verbb/workflow into craft-5
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	composer.json
#	src/templates/_widget/body.html
#	src/translations/en/workflow.php
  • Loading branch information
engram-design committed Jul 21, 2024
2 parents 09ac1fe + a14da0f commit c538ee8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
- Now requires PHP `8.2.0+`.
- Now requires Craft `5.0.0+`.

## 2.0.11 - 2024-07-21

### Added
- Add editor name to submission dashboard widget items.

### Changed
- Update non-English translations.
- Update English translations.

### Fixed
- Fix an error when comparing reviews with no data.

## 2.0.10 - 2024-05-18

### Changed
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/ReviewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function actionCompare(?int $newReviewId = null, ?int $oldReviewId = null
$variables = [
'newReview' => $newReview,
'oldReview' => $oldReview,
'diff' => Workflow::$plugin->getContent()->getDiff($oldReview->data, $newReview->data),
'diff' => Workflow::$plugin->getContent()->getDiff(($oldReview->data ?? []), ($newReview->data ?? [])),
'title' => "Compare review #{$oldReview->id} to #{$newReview->id}",
];

Expand Down Expand Up @@ -80,7 +80,7 @@ public function actionGetCompareModalBody(): Response

$html = $view->renderTemplate('workflow/reviews/_compare-modal', [
'review' => $newReview,
'diff' => Workflow::$plugin->getContent()->getDiff($oldReview->data, $newReview->data),
'diff' => Workflow::$plugin->getContent()->getDiff(($oldReview->data ?? []), ($newReview->data ?? [])),
]);

$headHtml = $view->getHeadHtml();
Expand Down
4 changes: 2 additions & 2 deletions src/models/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function getUser(): ?User
public function getElementRevision(): ?ElementInterface
{
$element = $this->getElement();
$attributes = $this->data;
$attributes = $this->data ?? [];
$fieldContent = ArrayHelper::remove($attributes, 'fields') ?? [];

// The element/draft on the review might've been deleted (applied)
Expand Down Expand Up @@ -196,7 +196,7 @@ public function hasChanges(): bool
$oldReview = Workflow::$plugin->getReviews()->getPreviousReviewById($this->id);

if ($oldReview) {
return (bool)Workflow::$plugin->getContent()->getDiff($oldReview->data, $this->data);
return (bool)Workflow::$plugin->getContent()->getDiff(($oldReview->data ?? []), ($this->data ?? []));
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/services/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getContentChangesCounts(Submission $submission): array
$nextReview = $reviews[$key + 1] ?? [];

if ($nextReview) {
$diff = $differ->doDiff(($nextReview->data ?? []), $review->data);
$diff = $differ->doDiff(($nextReview->data ?? []), ($review->data ?? []));

$content[] = $this->_convertDiffToCount($diff);
}
Expand Down

0 comments on commit c538ee8

Please sign in to comment.