diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index c23293789e..9489b31961 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -261,9 +261,8 @@ def do_add def register @competition = competition_from_params - if current_user - @registration = @competition.registrations.find_or_initialize_by(user_id: current_user.id, competition_id: @competition.id) - end + # This page is in react so we don't want to show the warnings twice + @show_warnings = false end def payment_denomination diff --git a/app/models/competition.rb b/app/models/competition.rb index 7a918b4e4d..3303639c53 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -492,8 +492,11 @@ def user_should_post_competition_results?(user) persisted? && is_probably_over? && !cancelled? && !self.results_submitted? && delegates.include?(user) end - def warnings_for(user) + # For react pages we do not want to show warnings as we show them in react + def warnings_for(user, show_warnings=true) warnings = {} + return warnings unless show_warnings + if self.showAtAll unless self.announced? warnings[:announcement] = I18n.t('competitions.messages.not_announced') diff --git a/app/views/competitions/_nav.html.erb b/app/views/competitions/_nav.html.erb index e0c862a5de..73447aee81 100644 --- a/app/views/competitions/_nav.html.erb +++ b/app/views/competitions/_nav.html.erb @@ -267,7 +267,7 @@ <% end %> <% end %> - <% @competition.warnings_for(current_user).each do |field, message| %> + <% @competition.warnings_for(current_user, @show_warnings).each do |field, message| %> <%= alert :warning, message, note: true %> <% end %>