FIX: broken select badge as user title (#5474)

* FIX: broken select badge as user title

* selected id wasn’t pass to underlying component
* <none> was rendered as an html tag <none></none>
* overriding a badge name wouldn’t work as it was using badge.name and not badge.display_name
* adds a spec to ensure this behavior is correct
This commit is contained in:
Joffrey JAFFEUX
2018-01-05 16:58:15 +01:00
committed by GitHub
parent ed4b845930
commit 642645ba9a
34 changed files with 65 additions and 35 deletions

View File

@@ -178,7 +178,7 @@ class UsersController < ApplicationController
user_badge = UserBadge.find_by(id: params[:user_badge_id])
if user_badge && user_badge.user == user && user_badge.badge.allow_title?
user.title = user_badge.badge.name
user.title = user_badge.badge.display_name
user.user_profile.badge_granted_title = true
user.save!
user.user_profile.save!