Skip to content

Commit

Permalink
Merge pull request #2055 from nanaya/less_false_hope
Browse files Browse the repository at this point in the history
Fixes user hype
  • Loading branch information
peppy committed Dec 20, 2017
2 parents a02b749 + f0d6f51 commit dab9487
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/Models/BeatmapDiscussion.php
Expand Up @@ -225,7 +225,7 @@ public function hasValidMessageType()
if ($this->user_id === $this->beatmapset->user_id) {
$validTypes[] = 'mapper_note';
} else {
if ($this->beatmap_id === null && $this->beatmapset->canBeHyped() && $this->beatmapset->validateHypeBy($this->user)) {
if ($this->beatmap_id === null && $this->beatmapset->canBeHyped() && $this->beatmapset->validateHypeBy($this->user)['result']) {
$validTypes[] = 'hype';
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Beatmapset.php
Expand Up @@ -924,7 +924,7 @@ public function validateHypeBy($user)

if ($hyped) {
$message = 'hyped';
} elseif ($user->remainingHype() === 0) {
} elseif ($user->remainingHype() <= 0) {
$message = 'limit_exceeded';
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Expand Up @@ -1075,7 +1075,7 @@ public function remainingHype()
->where('created_at', '>', Carbon::now()->subWeek())
->count();

$this->memoized[__FUNCTION__] = max(0, config('osu.beatmapset.user_weekly_hype') - $hyped);
$this->memoized[__FUNCTION__] = config('osu.beatmapset.user_weekly_hype') - $hyped;
}

return $this->memoized[__FUNCTION__];
Expand Down
Expand Up @@ -142,7 +142,7 @@ class BeatmapDiscussions.NewDiscussion extends React.PureComponent
else
@props.beatmapset.current_user_attributes.can_hype_reason

if @props.beatmapset.current_user_attributes.can_hype || @props.beatmapset.current_user_attributes.remaining_hype == 0
if @props.beatmapset.current_user_attributes.can_hype || @props.beatmapset.current_user_attributes.remaining_hype <= 0
message += " #{osu.trans 'beatmaps.hype.remaining', remaining: @props.beatmapset.current_user_attributes.remaining_hype}"
if @props.beatmapset.current_user_attributes.new_hype_time?
message += " #{osu.trans 'beatmaps.hype.new_time', new_time: osu.timeago(@props.beatmapset.current_user_attributes.new_hype_time)}"
Expand Down

0 comments on commit dab9487

Please sign in to comment.