diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb index baad692f0..a67cd3136 100644 --- a/app/controllers/api_keys_controller.rb +++ b/app/controllers/api_keys_controller.rb @@ -16,7 +16,7 @@ def index sig { void } def create user = T.must(current_user) - redirect_url = if Flipper.enabled?(:api_keys_in_profile, current_user) + redirect_url = if Flipper.enabled?(:trial_api_keys, current_user) api_keys_url else api_howto_url @@ -24,7 +24,7 @@ def create # For the time being limit users to only creating one API key if user.api_keys.empty? - if Flipper.enabled?(:api_keys_in_profile, current_user) + if Flipper.enabled?(:trial_api_keys, current_user) # Create a trial key which automatically expires and has a low daily limit # TODO: Extract this user.api_keys.create!(daily_limit: ApiKey.default_daily_limit_trial, expires_at: ApiKey.default_trial_duration_days.days.from_now) diff --git a/app/controllers/documentation_controller.rb b/app/controllers/documentation_controller.rb index 7d684c3bf..b62d88bed 100644 --- a/app/controllers/documentation_controller.rb +++ b/app/controllers/documentation_controller.rb @@ -15,14 +15,14 @@ def faq; end def api_howto # If feature flag is enabled show a new landing page instead # with a link to an extracted "API Developer Documentation" page - return unless Flipper.enabled?(:api_keys_in_profile, current_user) + return unless Flipper.enabled?(:trial_api_keys, current_user) render "api_landing" end sig { void } def api_developer - raise ActiveRecord::RecordNotFound unless Flipper.enabled?(:api_keys_in_profile, current_user) + raise ActiveRecord::RecordNotFound unless Flipper.enabled?(:trial_api_keys, current_user) end # rubocop:disable Naming/AccessorMethodName diff --git a/app/views/application/_menu_desktop.html.erb b/app/views/application/_menu_desktop.html.erb index 415d07521..a7a1809e4 100644 --- a/app/views/application/_menu_desktop.html.erb +++ b/app/views/application/_menu_desktop.html.erb @@ -4,7 +4,7 @@ <%= render NavItemComponent.new(href: root_path, selected: current_page?(root_path)).with_content("Home") %> <%= render NavItemComponent.new(href: address_applications_path, selected: current_page?(address_applications_path)).with_content("Search") %> <%= render NavItemComponent.new(href: api_howto_path, selected: current_page?(api_howto_path)) do %> - <% if Flipper.enabled?(:api_keys_in_profile, current_user) %> + <% if Flipper.enabled?(:trial_api_keys, current_user) %> Planning Alerts API <% else %> Get the Data diff --git a/app/views/application/_menu_mobile.html.erb b/app/views/application/_menu_mobile.html.erb index 1923d173a..777970953 100644 --- a/app/views/application/_menu_mobile.html.erb +++ b/app/views/application/_menu_mobile.html.erb @@ -18,7 +18,7 @@
  • <%= link_to "Search", address_applications_path, class: class_names("decoration-fuchsia", "decoration-4", "focus:outline-none", "focus:bg-sun-yellow", "underline" => current_page?(address_applications_path)) %>
  • <%= link_to api_howto_path, class: class_names("decoration-fuchsia", "decoration-4", "focus:outline-none", "focus:bg-sun-yellow", "underline" => current_page?(api_howto_path)) do %> - <% if Flipper.enabled?(:api_keys_in_profile, current_user) %> + <% if Flipper.enabled?(:trial_api_keys, current_user) %> Planning Alerts API <% else %> Get the Data diff --git a/app/views/application/_profile_menu.html.erb b/app/views/application/_profile_menu.html.erb index 6402867d0..49c1d0bcf 100644 --- a/app/views/application/_profile_menu.html.erb +++ b/app/views/application/_profile_menu.html.erb @@ -2,7 +2,7 @@
  • <%= pa_link_to_unless_current "Your alerts", alerts_path %>
  • <%= pa_link_to_unless_current "Create new alert", new_alert_path %>
  • <%= pa_link_to_unless_current "Your comments", personal_comments_path %>
  • - <% if Flipper.enabled?(:api_keys_in_profile, current_user) %> + <% if Flipper.enabled?(:trial_api_keys, current_user) %>
  • <%= pa_link_to_unless_current "Your API keys", api_keys_path %>
  • <% end %>
  • <%= pa_link_to_unless_current "Edit account", edit_user_registration_path %>
  • diff --git a/app/views/documentation/api_developer.html.erb b/app/views/documentation/api_developer.html.erb index 94a08cb70..3f47b8286 100644 --- a/app/views/documentation/api_developer.html.erb +++ b/app/views/documentation/api_developer.html.erb @@ -30,7 +30,7 @@ You need an API key to try out the examples below and use the API for yourself.

    - <% if Flipper.enabled?(:api_keys_in_profile, current_user) %> + <% if Flipper.enabled?(:trial_api_keys, current_user) %> <%= render ButtonComponent.new(tag: :a, size: "xl", type: :primary, href: confirm_api_keys_path).with_content("Create API key") %> <% else %> <%= pa_button_to "Create API key", api_keys_path, method: :post %> diff --git a/app/views/documentation/api_howto.html.erb b/app/views/documentation/api_howto.html.erb index d68789eef..1d0dd7ac3 100644 --- a/app/views/documentation/api_howto.html.erb +++ b/app/views/documentation/api_howto.html.erb @@ -33,7 +33,7 @@ You need an API key to try out the examples below and use the API for yourself.

    - <% if Flipper.enabled?(:api_keys_in_profile, current_user) %> + <% if Flipper.enabled?(:trial_api_keys, current_user) %> <%= render ButtonComponent.new(tag: :a, size: "xl", type: :primary, href: confirm_api_keys_path).with_content("Create API key") %> <% else %> <%= pa_button_to "Create API key", api_keys_path, method: :post %> diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index e53d9ef15..d0b61c517 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -18,7 +18,7 @@ "full_text_search" => "Allow searching for all applications containing the word 'tree', for example", "view_application_versions" => "Can view the update history of an application", "request_api_keys" => "Allow a new experimental flow for requesting API keys", - "api_keys_in_profile" => "Show and manage API keys inside your user profile and new API landing page" + "trial_api_keys" => "New API keys expire, new API landing page and user can show and manage API keys inside their profile" } end