diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fc69d0..f0fea9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.6 - 2022-01-06 +### Fixed +- Fix error when displaying a note from a suspended or deleted user (Fixes #5) + ## 1.0.5 - 2021-06-14 ### Fixed - Fix notes not being visible on drafts / revisions (Fixes #4) diff --git a/composer.json b/composer.json index 0ec6abd..6c0e518 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "ether/notes", "description": "A note taking field type for Craft CMS 3", - "version": "1.0.5", + "version": "1.0.6", "type": "craft-plugin", "license": "proprietary", "minimum-stability": "dev", diff --git a/src/Service.php b/src/Service.php index cdad0c7..9ab96ab 100644 --- a/src/Service.php +++ b/src/Service.php @@ -84,6 +84,7 @@ public function getNotesByElement (ElementInterface $element, $translatable = fa $users = User::find() ->select(new Expression($select)) ->id($userIds) + ->anyStatus() ->pairs(); $notes = []; @@ -93,7 +94,7 @@ public function getNotesByElement (ElementInterface $element, $translatable = fa $notes[] = new Note([ 'id' => $note['id'], 'note' => $note['note'], - 'author' => $users[$note['userId']], + 'author' => @$users[$note['userId']] ?? '[Deleted]', 'date' => DateTimeHelper::toDateTime($note['dateCreated'])->format(Field::$dateFormat), 'elementId' => $note['elementId'],