Skip to content

Commit 4890f05

Browse files
committed
Fix error when showing notes from deleted
Fixes #5
1 parent f7fabdf commit 4890f05

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.6 - 2022-01-06
2+
### Fixed
3+
- Fix error when displaying a note from a suspended or deleted user (Fixes #5)
4+
15
## 1.0.5 - 2021-06-14
26
### Fixed
37
- Fix notes not being visible on drafts / revisions (Fixes #4)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ether/notes",
33
"description": "A note taking field type for Craft CMS 3",
4-
"version": "1.0.5",
4+
"version": "1.0.6",
55
"type": "craft-plugin",
66
"license": "proprietary",
77
"minimum-stability": "dev",

src/Service.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public function getNotesByElement (ElementInterface $element, $translatable = fa
8484
$users = User::find()
8585
->select(new Expression($select))
8686
->id($userIds)
87+
->anyStatus()
8788
->pairs();
8889

8990
$notes = [];
@@ -93,7 +94,7 @@ public function getNotesByElement (ElementInterface $element, $translatable = fa
9394
$notes[] = new Note([
9495
'id' => $note['id'],
9596
'note' => $note['note'],
96-
'author' => $users[$note['userId']],
97+
'author' => @$users[$note['userId']] ?? '[Deleted]',
9798
'date' => DateTimeHelper::toDateTime($note['dateCreated'])->format(Field::$dateFormat),
9899

99100
'elementId' => $note['elementId'],

0 commit comments

Comments
 (0)