FIX: title selector needs to flag whether title comes from badge or not

This commit is contained in:
Neil Lalonde
2018-04-26 16:51:11 -04:00
parent 1e5e5acd4d
commit f7c4c71409
3 changed files with 62 additions and 4 deletions
+7 -2
View File
@@ -62,8 +62,13 @@ class UserUpdater
user.locale = attributes.fetch(:locale) { user.locale }
user.date_of_birth = attributes.fetch(:date_of_birth) { user.date_of_birth }
if guardian.can_grant_title?(user)
user.title = attributes.fetch(:title) { user.title }
if attributes[:title] &&
attributes[:title] != user.title &&
guardian.can_grant_title?(user, attributes[:title])
user.title = attributes[:title]
if user.badges.where(name: user.title).exists?
user_profile.badge_granted_title = true
end
end
CATEGORY_IDS.each do |attribute, level|