diff --git a/app/models/user.rb b/app/models/user.rb
index 7240c8929..4bb09c4a0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -133,6 +133,16 @@ class User < ActiveRecord::Base
update official_position: nil, official_level: 0
end
+ def has_official_email?
+ domain = Setting['email_domain_for_officials']
+ !email.blank? && ( (email.end_with? "@#{domain}") || (email.end_with? ".#{domain}") )
+ end
+
+ def display_official_position_badge?
+ return true if official_level > 1
+ official_position_badge? && official_level == 1
+ end
+
def block
debates_ids = Debate.where(author_id: id).pluck(:id)
comments_ids = Comment.where(user_id: id).pluck(:id)
@@ -197,11 +207,6 @@ class User < ActiveRecord::Base
!erased?
end
- def has_official_email?
- domain = Setting['email_domain_for_officials']
- !email.blank? && ( (email.end_with? "@#{domain}") || (email.end_with? ".#{domain}") )
- end
-
def locale
self[:locale] ||= I18n.default_locale.to_s
end
diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb
index 0e88614c5..7b5ff4b7d 100644
--- a/app/views/comments/_comment.html.erb
+++ b/app/views/comments/_comment.html.erb
@@ -36,7 +36,7 @@
<%= t("comments.comment.user_deleted") %>
<% else %>
<%= link_to comment.user.name, user_path(comment.user) %>
- <% if comment.user.official? %>
+ <% if comment.user.display_official_position_badge? %>
•