From b46b6e72d1906ca31e29855bda71f3498c8e203f Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 16 Jan 2019 12:04:12 +0000 Subject: [PATCH] FIX: Only add the trust level name for numeric trust levels Previously the TrustLevelAndStaffSetting would display 'new user' for staff/admin --- app/models/trust_level_setting.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/trust_level_setting.rb b/app/models/trust_level_setting.rb index a9bb747f868..ad48613fe9e 100644 --- a/app/models/trust_level_setting.rb +++ b/app/models/trust_level_setting.rb @@ -9,7 +9,12 @@ class TrustLevelSetting < EnumSiteSetting def self.values levels = TrustLevel.all - @values ||= valid_values.map { |x| { name: "#{x}: #{levels[x.to_i].name}", value: x } } + @values ||= valid_values.map { |x| + { + name: x.is_a?(Integer) ? "#{x}: #{levels[x.to_i].name}" : x, + value: x + } + } end def self.valid_values