From 77f76b1b5af4876f11043608dadd01cb704eb358 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Thu, 9 Mar 2017 14:36:24 -0500 Subject: [PATCH] variable name fix and make is_tester method global for reuse in views --- app/services/follow_service.rb | 6 +---- app/views/users/edit.html.erb | 34 +++++++++++++------------ config/initializers/internal_testers.rb | 3 +++ 3 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 config/initializers/internal_testers.rb diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index e0d23002..8434baca 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -41,13 +41,9 @@ class FollowService if reason == 'created' return user.settings.follow_map_on_created == '1' elsif reason == 'contributed' - return user.settings.follow_map_contributed == '1' + return user.settings.follow_map_on_contributed == '1' end end end - - def is_tester(user) - %w(connorturland@gmail.com devin@callysto.com chessscholar@gmail.com solaureum@gmail.com ishanshapiro@gmail.com).include?(user.email) - end end end diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 1ee406e7..0bd2a366 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -45,22 +45,24 @@ <%= form.check_box :emails_allowed, class: 'inline' %> Send Metamaps notifications to my email. <% end %> - <%= fields_for :settings, @user.settings do |settings| %> - <%= settings.label :follow_topic_on_created, class: 'firstFieldText' do %> - <%= settings.check_box :follow_topic_on_created, class: 'inline' %> - Auto-follow topics you create. - <% end %> - <%= settings.label :follow_topic_on_contributed, class: 'firstFieldText' do %> - <%= settings.check_box :follow_topic_on_contributed, class: 'inline' %> - Auto-follow topics you edit. - <% end %> - <%= settings.label :follow_map_on_created, class: 'firstFieldText' do %> - <%= settings.check_box :follow_map_on_created, class: 'inline' %> - Auto-follow maps you create. - <% end %> - <%= settings.label :follow_map_on_contributed, class: 'firstFieldText' do %> - <%= settings.check_box :follow_map_on_contributed, class: 'inline' %> - Auto-follow maps you edit. + <% if is_tester(@user) %> + <%= fields_for :settings, @user.settings do |settings| %> + <%= settings.label :follow_topic_on_created, class: 'firstFieldText' do %> + <%= settings.check_box :follow_topic_on_created, class: 'inline' %> + Auto-follow topics you create. + <% end %> + <%= settings.label :follow_topic_on_contributed, class: 'firstFieldText' do %> + <%= settings.check_box :follow_topic_on_contributed, class: 'inline' %> + Auto-follow topics you edit. + <% end %> + <%= settings.label :follow_map_on_created, class: 'firstFieldText' do %> + <%= settings.check_box :follow_map_on_created, class: 'inline' %> + Auto-follow maps you create. + <% end %> + <%= settings.label :follow_map_on_contributed, class: 'firstFieldText' do %> + <%= settings.check_box :follow_map_on_contributed, class: 'inline' %> + Auto-follow maps you edit. + <% end %> <% end %> <% end %> diff --git a/config/initializers/internal_testers.rb b/config/initializers/internal_testers.rb new file mode 100644 index 00000000..079fc119 --- /dev/null +++ b/config/initializers/internal_testers.rb @@ -0,0 +1,3 @@ +def is_tester(user) + user && %w(connorturland@gmail.com devin@callysto.com chessscholar@gmail.com solaureum@gmail.com ishanshapiro@gmail.com).include?(user.email) +end