mirror of
https://github.com/flarum/core.git
synced 2025-08-18 14:22:02 +02:00
Rename discussion.readNumber
This commit is contained in:
@@ -54,7 +54,7 @@ class UpdateDiscussionController extends AbstractShowController
|
||||
|
||||
// TODO: Refactor the ReadDiscussion (state) command into EditDiscussion?
|
||||
// That's what extensions will do anyway.
|
||||
if ($readNumber = array_get($data, 'attributes.readNumber')) {
|
||||
if ($readNumber = array_get($data, 'attributes.lastReadPostNumber')) {
|
||||
$state = $this->bus->dispatch(
|
||||
new ReadDiscussion($discussionId, $actor, $readNumber)
|
||||
);
|
||||
|
@@ -58,7 +58,7 @@ class DiscussionSerializer extends BasicDiscussionSerializer
|
||||
if ($state = $discussion->state) {
|
||||
$attributes += [
|
||||
'lastReadAt' => $this->formatDate($state->last_read_at),
|
||||
'readNumber' => (int) $state->last_read_post_number
|
||||
'lastReadPostNumber' => (int) $state->last_read_post_number
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -34,17 +34,17 @@ class ReadDiscussion
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $readNumber;
|
||||
public $lastReadPostNumber;
|
||||
|
||||
/**
|
||||
* @param int $discussionId The ID of the discussion to mark as read.
|
||||
* @param User $actor The user to mark the discussion as read for.
|
||||
* @param int $readNumber The number of the post to mark as read.
|
||||
* @param int $lastReadPostNumber The number of the post to mark as read.
|
||||
*/
|
||||
public function __construct($discussionId, User $actor, $readNumber)
|
||||
public function __construct($discussionId, User $actor, $lastReadPostNumber)
|
||||
{
|
||||
$this->discussionId = $discussionId;
|
||||
$this->actor = $actor;
|
||||
$this->readNumber = $readNumber;
|
||||
$this->lastReadPostNumber = $lastReadPostNumber;
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ class ReadDiscussionHandler
|
||||
$discussion = $this->discussions->findOrFail($command->discussionId, $actor);
|
||||
|
||||
$state = $discussion->stateFor($actor);
|
||||
$state->read($command->readNumber);
|
||||
$state->read($command->lastReadPostNumber);
|
||||
|
||||
$this->events->dispatch(
|
||||
new UserDataSaving($state)
|
||||
|
Reference in New Issue
Block a user