Skip to content

Commit

Permalink
Merge pull request #11923 from craftcms/bugfix/dont-require-creatorid
Browse files Browse the repository at this point in the history
Don't require `creatorId`
  • Loading branch information
brandonkelly authored Sep 13, 2022
2 parents c9167f3 + ece6241 commit 7c232ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
- `{% cache %}` tags now store any HTML registered with `{% html %}` tags. ([#11811](https://github.com/craftcms/cms/discussions/11811))
- `{% cache %}` tags and GraphQL query caches now get a max cache duration based on the fetched/referenced entries’ expiry dates. ([#8525](https://github.com/craftcms/cms/discussions/8525), [#11901](https://github.com/craftcms/cms/pull/11901))
- Control panel `.twig` templates are now prioritized over `.html`. ([#11809](https://github.com/craftcms/cms/discussions/11809), [#11840](https://github.com/craftcms/cms/pull/11840))
- `craft\events\DraftEvent::$creatorId` is now nullable. ([#11904](https://github.com/craftcms/cms/issues/11904))
- `craft\helpers\Component::iconSvg()` now namespaces the SVG contents, and adds `aria-hidden="true"`. ([#11703](https://github.com/craftcms/cms/pull/11703))
- `craft\services\Drafts::createDraft()` now accepts `null` passed to its `$creatorId` argument. ([#11904](https://github.com/craftcms/cms/issues/11904))
- `craft\services\Search::EVENT_AFTER_SEARCH` now includes the computed search result scores, set to `craft\events\SearchEvent::$scores`, and any changes made to it will be returned by `searchElements()`. ([#11882](https://github.com/craftcms/cms/discussions/11882))
- `craft\services\Search::EVENT_BEFORE_INDEX_KEYWORDS` is now cancellable by setting `$event->isValid` to `false`. ([#11705](https://github.com/craftcms/cms/discussions/11705))
- `checkboxSelect` inputs without `showAllOption: true` now post an empty value if no options were selected. ([#11748](https://github.com/craftcms/cms/issues/11748))
Expand Down
4 changes: 2 additions & 2 deletions src/events/DraftEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class DraftEvent extends Event
public ElementInterface $canonical;

/**
* @var int The creator ID
* @var int|null The creator ID
*/
public int $creatorId;
public ?int $creatorId = null;

/**
* @var bool Whether this is a provisional draft
Expand Down
4 changes: 2 additions & 2 deletions src/services/Drafts.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function getEditableDrafts(ElementInterface $element, ?string $permission
*
* @template T of ElementInterface
* @param T $canonical The element to create a draft for
* @param int $creatorId The user ID that the draft should be attributed to
* @param int|null $creatorId The user ID that the draft should be attributed to
* @param string|null $name The draft name
* @param string|null $notes The draft notes
* @param array $newAttributes any attributes to apply to the draft
Expand All @@ -116,7 +116,7 @@ public function getEditableDrafts(ElementInterface $element, ?string $permission
*/
public function createDraft(
ElementInterface $canonical,
int $creatorId,
?int $creatorId = null,
?string $name = null,
?string $notes = null,
array $newAttributes = [],
Expand Down

0 comments on commit 7c232ea

Please sign in to comment.