Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add voter participation sticker for Project Loved #8652

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Include Loved voted status in transformer for profile pages
  • Loading branch information
cl8n committed Feb 20, 2022
commit a0778a3b0f5d77b0e7124d929d3d752ea56d4d76
1 change: 1 addition & 0 deletions app/Http/Controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ public function me($mode = null)
* - statistics.variants
* - support_level
* - user_achievements
* - voted_in_project_loved
*
* @urlParam user integer required Id or username of the user. Id lookup is prioritised unless `key` parameter is specified. Previous usernames are also checked in some cases. Example: 1
* @urlParam mode string [GameMode](#gamemode). User default mode will be used if not specified. Example: osu
Expand Down
7 changes: 7 additions & 0 deletions app/Transformers/UserCompactTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class UserCompactTransformer extends TransformerAbstract
'mapping_follower_count',
'previous_usernames',
'support_level',
'voted_in_project_loved',
];

protected string $mode;
Expand Down Expand Up @@ -85,6 +86,7 @@ class UserCompactTransformer extends TransformerAbstract
'unread_pm_count',
'user_achievements',
'user_preferences',
'voted_in_project_loved',
// TODO: should be changed to rank_history
// TODO: should be alphabetically ordered but lazer relies on being after statistics. can revert to alphabetical after 2020-05-01
'rankHistory',
Expand Down Expand Up @@ -427,6 +429,11 @@ public function includeUserPreferences(User $user)
]));
}

public function includeVotedInProjectLoved(User $user)
{
return $this->primitive(app('loved-polls')->userVotedAny($user));
}

public function setMode(string $mode)
{
$this->mode = $mode;
Expand Down
1 change: 1 addition & 0 deletions resources/views/docs/_structures/user_compact.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ support_level | |
unread_pm_count | |
user_achievements | |
user_preferences | |
voted_in_project_loved | boolean

<div id="usercompact-profilebanner" data-unique="usercompact-profilebanner"></div>

Expand Down