Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Oct 14, 2024
1 parent 0eac928 commit 231278a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Api/AttachRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
protected SettingsRepositoryInterface $settings
) {
}

public function __invoke(PostSerializer $serializer, Post $post): ?Relationship
{
$viewIPs = $serializer->getActor()->can('viewIps', $post);
Expand Down
14 changes: 11 additions & 3 deletions src/Api/BasicUserAttributes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of fof/geoip.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace FoF\GeoIP\Api;

use Flarum\Api\Serializer\BasicUserSerializer;
Expand All @@ -11,15 +20,14 @@ class BasicUserAttributes
public function __construct(
protected SettingsRepositoryInterface $settings
) {

}

public function __invoke(BasicUserSerializer $serializer, User $user, array $attributes): array
{
if ($this->settings->get('fof-geoip.showFlag')) {
$attributes['showIPCountry'] = (bool) $user->getPreference('showIPCountry');
}

return $attributes;
}
}
11 changes: 10 additions & 1 deletion src/Api/CurrentUserAttributes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of fof/geoip.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace FoF\GeoIP\Api;

use Flarum\Api\Serializer\CurrentUserSerializer;
Expand All @@ -12,7 +21,7 @@ public function __invoke(CurrentUserSerializer $serializer, User $user, array $a
if ($serializer->getActor()->can('fof-geoip.canSeeCountry')) {
$attributes['canSeeCountry'] = true;
}

return $attributes;
}
}

0 comments on commit 231278a

Please sign in to comment.