Skip to content

Commit

Permalink
Merge pull request #946 from DFE-Digital/disable-new-registartions
Browse files Browse the repository at this point in the history
Allow to disable registration in Flipper
  • Loading branch information
peteryates authored Oct 23, 2023
2 parents a2fb50d + 73d77e0 commit edadc41
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
description: Node version
type: string
required: false
default: "16.20.1"
default: "16.20.2"

jobs:
rspec:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions app/lib/services/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Feature
REGISTRATION_OPEN_DATE = Time.zone.parse("6 June 2022 12:00")

REGISTRATION_CLOSED_KEY = "Registration closed".freeze
REGISTRATION_DISABLED = "Registration disabled".freeze

FEATURE_FLAG_KEYS = [
REGISTRATION_CLOSED_KEY,
Expand Down Expand Up @@ -30,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
5 changes: 4 additions & 1 deletion app/views/accounts/user_registrations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
8 changes: 8 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
<% end %>
<% end %>
<% 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, new registrations are currently disabled. If you already started your registration, you can continue.")
%>
<% end %>
<% end %>
<% if flash[:success] %>
<%=
render GovukComponent::NotificationBannerComponent.new(
Expand Down
17 changes: 9 additions & 8 deletions app/views/registration_wizard/start.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@

<p class="govuk-body"><%= 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.</p>

<%=
render(
'shared/get_an_identity/redirect_button',
button_text: "Start now"
)
%>


<% if Services::Feature.registration_enabled? %>
<%=
render(
'shared/get_an_identity/redirect_button',
button_text: "Start now"
)
%>
<% end %>

</div>
</div>
2 changes: 1 addition & 1 deletion global_config/review.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"engines": {
"node": "16.20.1"
"node": "16.20.2"
},
"dependencies": {
"@babel/preset-react": "^7.22.15",
Expand Down

0 comments on commit edadc41

Please sign in to comment.