-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Only display vote notification settings when a user can actually recieve them, based on admin settings #90 * Apply fixes from StyleCI * fix: php8.1 error when settings key is null * fix: error when rank badges preference is not zero #29 * feat: option to prevent users voting for themselves #28 * Apply fixes from StyleCI Co-authored-by: StyleCI Bot <[email protected]>
- Loading branch information
1 parent
b4d70f0
commit 4fbd0c1
Showing
7 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of fof/gamification. | ||
* | ||
* Copyright (c) FriendsOfFlarum. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FoF\Gamification; | ||
|
||
use Flarum\Api\Serializer\UserSerializer; | ||
use Flarum\User\User; | ||
|
||
class AddUserAttributes | ||
{ | ||
public function __invoke(UserSerializer $serializer, User $user, array $attributes): array | ||
{ | ||
$attributes['points'] = $user->votes; | ||
$attributes['canHaveVotingNotifications'] = $user->hasPermission('discussion.upvote_notifications') || $user->hasPermission('discussion.downvote_notifications'); | ||
|
||
return $attributes; | ||
} | ||
} |