Skip to content

Commit

Permalink
Fix errors from previous commits
Browse files Browse the repository at this point in the history
  • Loading branch information
askvortsov1 committed May 28, 2020
1 parent bc1097c commit b7b0f3c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/Api/Serializer/DiscussionSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ protected function getDefaultAttributes($discussion)
'createdAt' => $this->formatDate($discussion->created_at),
'lastPostedAt' => $this->formatDate($discussion->last_posted_at),
'lastPostNumber' => (int) $discussion->last_post_number,
'canReply' => $this->user->can('reply', $discussion),
'canRename' => $this->user->can('rename', $discussion),
'canDelete' => $this->user->can('delete', $discussion),
'canHide' => $this->user->can('hide', $discussion)
'canReply' => $this->actor->can('reply', $discussion),
'canRename' => $this->actor->can('rename', $discussion),
'canDelete' => $this->actor->can('delete', $discussion),
'canHide' => $this->actor->can('hide', $discussion)
];

if ($discussion->hidden_at) {
Expand Down
8 changes: 4 additions & 4 deletions src/Api/Serializer/PostSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ protected function getDefaultAttributes($post)

unset($attributes['content']);

$canEdit = $this->user->can('edit', $post);
$canEdit = $this->actor->can('edit', $post);

if ($post instanceof CommentPost) {
if ($canEdit) {
$attributes['content'] = $post->content;
}
if ($this->user->can('viewIps', $post)) {
if ($this->actor->can('viewIps', $post)) {
$attributes['ipAddress'] = $post->ip_address;
}
} else {
Expand All @@ -46,8 +46,8 @@ protected function getDefaultAttributes($post)

$attributes += [
'canEdit' => $canEdit,
'canDelete' => $this->user->can('delete', $post),
'canHide' => $this->user->can('hide', $post)
'canDelete' => $this->actor->can('delete', $post),
'canHide' => $this->actor->can('hide', $post)
];

return $attributes;
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Serializer/UserSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ protected function getDefaultAttributes($user)
{
$attributes = parent::getDefaultAttributes($user);

$canEdit = $this->user->can('edit', $user);
$canEdit = $this->actor->can('edit', $user);

$attributes += [
'joinTime' => $this->formatDate($user->joined_at),
'discussionCount' => (int) $user->discussion_count,
'commentCount' => (int) $user->comment_count,
'canEdit' => $canEdit,
'canDelete' => $this->user->can('delete', $user),
'canDelete' => $this->actor->can('delete', $user),
];

if ($user->getPreference('discloseOnline') || $this->actor->can('viewLastSeenAt', $user)) {
Expand Down
2 changes: 1 addition & 1 deletion src/User/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Gate
/**
* @var Dispatcher
*/
protected static $events;
protected $events;

/**
* @param Dispatcher $events
Expand Down

0 comments on commit b7b0f3c

Please sign in to comment.