From 778d1bcc29c3da8db77a3d37e4dc0a91d2b9c1c8 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Thu, 19 Oct 2023 13:59:15 +0100 Subject: [PATCH 01/10] Allow to disable registartion in Flipper --- app/lib/services/feature.rb | 1 + app/views/layouts/application.html.erb | 8 ++++++++ app/views/registration_wizard/start.html.erb | 17 +++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/lib/services/feature.rb b/app/lib/services/feature.rb index f65f9d0cfc..361b079aed 100644 --- a/app/lib/services/feature.rb +++ b/app/lib/services/feature.rb @@ -14,6 +14,7 @@ def initialize_feature_flags Flipper.add(feature_flag_key) end Flipper.enable(:maths_npq) + Flipper.enable(:disable_new_registrations) end # This is always true but is checked so that it is explicit diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index eb35dbb9ce..f0e623a46d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -67,6 +67,14 @@ <% end %> <% end %> + <% if Flipper.enabled?(:disable_new_registrations) %> + <%= govuk_notification_banner(title_text: "Maintenance notice") do |banner| %> + <% banner.with_heading( + text: "Due to scheduled mainenance taking place soon, the new registrations are currently disabled. If you already started your registration, you can continue.") + %> + <% end %> + <% end %> + <% if flash[:success] %> <%= render GovukComponent::NotificationBannerComponent.new( diff --git a/app/views/registration_wizard/start.html.erb b/app/views/registration_wizard/start.html.erb index 006067765c..029c386224 100644 --- a/app/views/registration_wizard/start.html.erb +++ b/app/views/registration_wizard/start.html.erb @@ -26,13 +26,14 @@

<%= govuk_link_to("Check if you have a teacher reference number (TRN)", "https://find-a-lost-trn.education.gov.uk/start") %>. If you’re not a teacher you can still register, but you’ll need to request a TRN. We’ll show you how to do this.

- <%= - render( - 'shared/get_an_identity/redirect_button', - button_text: "Start now" - ) - %> - - + <% if Flipper.enabled?(:disable_new_registrations) %> + <%= + render( + 'shared/get_an_identity/redirect_button', + button_text: "Start now" + ) + %> + <% end %> + From ee0140c28e558f43ef770da53d2c6d925804123e Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Thu, 19 Oct 2023 14:09:32 +0100 Subject: [PATCH 02/10] Try to deploy review app --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b8e5cf4e44..572786d323 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "engines": { - "node": "16.20.1" + "node": "16.20.2" }, "dependencies": { "@babel/preset-react": "^7.22.15", From d235f84f09956296e4eb40161cfe39403572312b Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Thu, 19 Oct 2023 15:28:42 +0100 Subject: [PATCH 03/10] Fix logic --- app/views/layouts/application.html.erb | 1 + app/views/registration_wizard/start.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f0e623a46d..fd317167fd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -68,6 +68,7 @@ <% end %> <% if Flipper.enabled?(:disable_new_registrations) %> + foo bar <%= govuk_notification_banner(title_text: "Maintenance notice") do |banner| %> <% banner.with_heading( text: "Due to scheduled mainenance taking place soon, the new registrations are currently disabled. If you already started your registration, you can continue.") diff --git a/app/views/registration_wizard/start.html.erb b/app/views/registration_wizard/start.html.erb index 029c386224..ab6846134c 100644 --- a/app/views/registration_wizard/start.html.erb +++ b/app/views/registration_wizard/start.html.erb @@ -26,7 +26,7 @@

<%= govuk_link_to("Check if you have a teacher reference number (TRN)", "https://find-a-lost-trn.education.gov.uk/start") %>. If you’re not a teacher you can still register, but you’ll need to request a TRN. We’ll show you how to do this.

- <% if Flipper.enabled?(:disable_new_registrations) %> + <% unless Flipper.enabled?(:disable_new_registrations) %> <%= render( 'shared/get_an_identity/redirect_button', From 91e91d8e2db158d44dc979663ac5b6313896a563 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Thu, 19 Oct 2023 15:38:48 +0100 Subject: [PATCH 04/10] Remove debug --- app/views/layouts/application.html.erb | 1 - global_config/review.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index fd317167fd..f0e623a46d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -68,7 +68,6 @@ <% end %> <% if Flipper.enabled?(:disable_new_registrations) %> - foo bar <%= govuk_notification_banner(title_text: "Maintenance notice") do |banner| %> <% banner.with_heading( text: "Due to scheduled mainenance taking place soon, the new registrations are currently disabled. If you already started your registration, you can continue.") diff --git a/global_config/review.sh b/global_config/review.sh index e80d8af832..93f8193e7e 100644 --- a/global_config/review.sh +++ b/global_config/review.sh @@ -5,4 +5,4 @@ AZURE_SUBSCRIPTION=s189-teacher-services-cloud-test AZURE_RESOURCE_PREFIX=s189t01 KV_PURGE_PROTECTION=false CONFIG_LONG=review -NAMESPACE=cpd-review +NAMESPACE=cpd-development From be6afe7ddfdb3e6cd60c9cc5a160e688ffa36ae0 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Thu, 19 Oct 2023 16:45:33 +0100 Subject: [PATCH 05/10] Use feature flags properly --- app/lib/services/feature.rb | 20 ++++++++++++++++++-- app/views/layouts/application.html.erb | 2 +- app/views/registration_wizard/start.html.erb | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/lib/services/feature.rb b/app/lib/services/feature.rb index 361b079aed..ee7e451485 100644 --- a/app/lib/services/feature.rb +++ b/app/lib/services/feature.rb @@ -2,7 +2,8 @@ module Services class Feature REGISTRATION_OPEN_DATE = Time.zone.parse("6 June 2022 12:00") - REGISTRATION_CLOSED_KEY = "Registration closed".freeze + REGISTRATION_CLOSED_KEY = "Registration closed".freeze + REGISTRATION_DISABLED = "Registration disabled".freeze FEATURE_FLAG_KEYS = [ REGISTRATION_CLOSED_KEY, @@ -14,7 +15,6 @@ def initialize_feature_flags Flipper.add(feature_flag_key) end Flipper.enable(:maths_npq) - Flipper.enable(:disable_new_registrations) end # This is always true but is checked so that it is explicit @@ -31,6 +31,22 @@ def trn_required? def registration_closed? Flipper.enabled?(REGISTRATION_CLOSED_KEY) end + + def registration_disabled? + Flipper.enabled?(REGISTRATION_DISABLED) + end + + def registration_enabled? + !Flipper.enabled?(REGISTRATION_DISABLED) + end + + def disable_registration! + Flipper.enable(REGISTRATION_DISABLED) + end + + def enable_registration! + Flipper.disable(REGISTRATION_DISABLED) + end end end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f0e623a46d..9047fb1811 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -67,7 +67,7 @@ <% end %> <% end %> - <% if Flipper.enabled?(:disable_new_registrations) %> + <% if Services::Feature.registration_disabled? %> <%= govuk_notification_banner(title_text: "Maintenance notice") do |banner| %> <% banner.with_heading( text: "Due to scheduled mainenance taking place soon, the new registrations are currently disabled. If you already started your registration, you can continue.") diff --git a/app/views/registration_wizard/start.html.erb b/app/views/registration_wizard/start.html.erb index ab6846134c..9dbe53bb97 100644 --- a/app/views/registration_wizard/start.html.erb +++ b/app/views/registration_wizard/start.html.erb @@ -26,7 +26,7 @@

<%= govuk_link_to("Check if you have a teacher reference number (TRN)", "https://find-a-lost-trn.education.gov.uk/start") %>. If you’re not a teacher you can still register, but you’ll need to request a TRN. We’ll show you how to do this.

- <% unless Flipper.enabled?(:disable_new_registrations) %> + <% if Services::Feature.registration_enabled? %> <%= render( 'shared/get_an_identity/redirect_button', From ac3ef2fc290f195dcdc42ab5839eaab43de08339 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Fri, 20 Oct 2023 09:09:19 +0100 Subject: [PATCH 06/10] Typo --- app/views/layouts/application.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9047fb1811..aea924d0f9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -70,7 +70,7 @@ <% if Services::Feature.registration_disabled? %> <%= govuk_notification_banner(title_text: "Maintenance notice") do |banner| %> <% banner.with_heading( - text: "Due to scheduled mainenance taking place soon, the new registrations are currently disabled. If you already started your registration, you can continue.") + text: "Due to scheduled mainenance taking place soon, new registrations are currently disabled. If you already started your registration, you can continue.") %> <% end %> <% end %> From bf1013e032d1c013db4c3c102e1e49a08e60b664 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Fri, 20 Oct 2023 11:04:40 +0100 Subject: [PATCH 07/10] Use package.json from main branch --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 572786d323..b8e5cf4e44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "engines": { - "node": "16.20.2" + "node": "16.20.1" }, "dependencies": { "@babel/preset-react": "^7.22.15", From 6cea8cd29c1aedc4b358a00cf0544d5fa2f32e1d Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Fri, 20 Oct 2023 11:26:32 +0100 Subject: [PATCH 08/10] Try to work out node version --- .github/workflows/rspec.yml | 2 +- .github/workflows/specs.yml | 6 +++--- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index bfdd9f0c83..61cf8fdeb5 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -12,7 +12,7 @@ on: description: Node version type: string required: false - default: "16.20.1" + default: "16.20.2" jobs: rspec: diff --git a/.github/workflows/specs.yml b/.github/workflows/specs.yml index 4551082431..e084c6c7ee 100644 --- a/.github/workflows/specs.yml +++ b/.github/workflows/specs.yml @@ -40,7 +40,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v1 with: - node-version: '16.20.1' + node-version: '16.20.2' - name: Set up ruby gem cache uses: actions/cache@v3 @@ -126,7 +126,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v1 with: - node-version: '16.20.1' + node-version: '16.20.2' - name: Set up ruby gem cache uses: actions/cache@v3 @@ -160,7 +160,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v1 with: - node-version: '16.20.1' + node-version: '16.20.2' - name: Set up ruby gem cache uses: actions/cache@v3 diff --git a/package.json b/package.json index b8e5cf4e44..572786d323 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "engines": { - "node": "16.20.1" + "node": "16.20.2" }, "dependencies": { "@babel/preset-react": "^7.22.15", From dbdb9191a5c306e469b016bb91ca8a9cc3cf41d9 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Fri, 20 Oct 2023 11:39:23 +0100 Subject: [PATCH 09/10] Fix ruboco --- app/lib/services/feature.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/services/feature.rb b/app/lib/services/feature.rb index ee7e451485..919ac6ed7d 100644 --- a/app/lib/services/feature.rb +++ b/app/lib/services/feature.rb @@ -2,7 +2,7 @@ module Services class Feature REGISTRATION_OPEN_DATE = Time.zone.parse("6 June 2022 12:00") - REGISTRATION_CLOSED_KEY = "Registration closed".freeze + REGISTRATION_CLOSED_KEY = "Registration closed".freeze REGISTRATION_DISABLED = "Registration disabled".freeze FEATURE_FLAG_KEYS = [ From 73d77e0adc78605ba538d50c73c01746343aca90 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Fri, 20 Oct 2023 13:09:02 +0100 Subject: [PATCH 10/10] Disable registration from your account page --- app/views/accounts/user_registrations/show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/accounts/user_registrations/show.html.erb b/app/views/accounts/user_registrations/show.html.erb index 04d9b9d8a2..27616789c5 100644 --- a/app/views/accounts/user_registrations/show.html.erb +++ b/app/views/accounts/user_registrations/show.html.erb @@ -35,4 +35,7 @@ <%= render "accounts/personal_details", application: @application %> <%= render "accounts/work_details", application: @application %> -<%= render partial: 'registration_wizard/shared/register_for_an_npq' %> + +<% if Services::Feature.registration_enabled? %> + <%= render partial: 'registration_wizard/shared/register_for_an_npq' %> +<% end %>