Skip to content

Commit

Permalink
Fix User#update_title for non-rolify stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
NuckChorris committed Oct 31, 2020
1 parent 2dc323e commit e92dc68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class User < ApplicationRecord
enum email_status: %i[email_unconfirmed email_confirmed email_bounced]
enum title_language_preference: %i[canonical romanized localized]

rolify after_add: :update_title, after_remove: :update_title
flag :permissions, %i[admin community_mod database_mod]
has_secure_password validations: false
update_index('users#user') { self }
Expand Down Expand Up @@ -345,7 +344,7 @@ def alts
alts.sort_by { |_, v| v }.reverse
end

def update_title(_role)
def update_title
if permissions.admin?
update(title: 'Staff')
elsif permissions.database_mod? || permissions.community_mod?
Expand Down Expand Up @@ -431,6 +430,7 @@ def update_profile_completed!
end
self.previous_email = nil if confirmed_at_changed?
self.previous_email = email_was if email_changed?
update_title
update_profile_completed
update_feed_completed
end
Expand Down

0 comments on commit e92dc68

Please sign in to comment.