mirror of
https://github.com/flarum/core.git
synced 2025-06-28 21:55:30 +02:00
Temporary fix for read marking
This commit is contained in:
@ -94,7 +94,7 @@ export default Ember.Controller.extend(Ember.Evented, UseComposerMixin, {
|
|||||||
this.set('start', startNumber);
|
this.set('start', startNumber);
|
||||||
|
|
||||||
var discussion = this.get('model');
|
var discussion = this.get('model');
|
||||||
if (endNumber > discussion.get('readNumber')) {
|
if (endNumber > discussion.get('readNumber') && this.get('session.isAuthenticated')) {
|
||||||
discussion.set('readNumber', endNumber);
|
discussion.set('readNumber', endNumber);
|
||||||
discussion.save();
|
discussion.save();
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,14 @@ class UpdateAction extends BaseAction
|
|||||||
// As usual, however, we will fire an event to allow plugins to update
|
// As usual, however, we will fire an event to allow plugins to update
|
||||||
// additional properties.
|
// additional properties.
|
||||||
if ($data = array_except($params->get('discussions'), ['readNumber'])) {
|
if ($data = array_except($params->get('discussions'), ['readNumber'])) {
|
||||||
|
try {
|
||||||
$command = new EditDiscussionCommand($discussionId, $user);
|
$command = new EditDiscussionCommand($discussionId, $user);
|
||||||
$this->hydrate($command, $params->get('discussions'));
|
$this->hydrate($command, $params->get('discussions'));
|
||||||
$discussion = $this->dispatch($command, $params);
|
$discussion = $this->dispatch($command, $params);
|
||||||
|
} catch (PermissionDeniedException $e) {
|
||||||
|
// Temporary fix. See @todo below
|
||||||
|
$discussion = \Flarum\Core\Models\Discussion::find($discussionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, if a read number was specified in the request, we will run the
|
// Next, if a read number was specified in the request, we will run the
|
||||||
@ -35,7 +40,7 @@ class UpdateAction extends BaseAction
|
|||||||
//
|
//
|
||||||
// @todo Currently, if the user doesn't have permission to edit a
|
// @todo Currently, if the user doesn't have permission to edit a
|
||||||
// discussion, they're unable to update their readNumber because a
|
// discussion, they're unable to update their readNumber because a
|
||||||
// PermissionsDeniedException is thrown by the
|
// PermissionDeniedException is thrown by the
|
||||||
// EditDiscussionCommand above. So this needs to be extracted into
|
// EditDiscussionCommand above. So this needs to be extracted into
|
||||||
// its own endpoint.
|
// its own endpoint.
|
||||||
if ($readNumber = $params->get('discussions.readNumber')) {
|
if ($readNumber = $params->get('discussions.readNumber')) {
|
||||||
|
Reference in New Issue
Block a user