mirror of
https://github.com/flarum/core.git
synced 2025-08-04 23:47:32 +02:00
Extensibility: data when starting a new discussion
This commit is contained in:
@@ -26,7 +26,7 @@ class StartDiscussionCommandHandler
|
||||
// an opportunity to alter the discussion entity based on data in the
|
||||
// command they may have passed through in the controller.
|
||||
$discussion = Discussion::start(
|
||||
$command->title,
|
||||
array_get($command->data, 'title'),
|
||||
$command->user
|
||||
);
|
||||
|
||||
@@ -41,13 +41,9 @@ class StartDiscussionCommandHandler
|
||||
// will trigger a domain event that is slightly semantically incorrect
|
||||
// in this situation (PostWasPosted), we may need to reconsider someday.
|
||||
$post = $this->bus->dispatch(
|
||||
new PostReplyCommand($discussion->id, $command->content, $command->user)
|
||||
new PostReplyCommand($discussion->id, array_get($command->data, 'content'), $command->user)
|
||||
);
|
||||
|
||||
// The discussion may have been updated by the PostReplyCommand; we need
|
||||
// to refresh its data.
|
||||
$discussion = $post->discussion;
|
||||
|
||||
return $discussion;
|
||||
return $post->discussion;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user