Skip to content

Commit

Permalink
[WIP] Remove HTTP feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
AgaDufrat committed Sep 6, 2023
1 parent dae4e22 commit dc92468
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 201 deletions.
13 changes: 1 addition & 12 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def show
elsif is_history_page?
show_history_page
else
set_use_recommended_related_links_header
set_access_control_allow_origin_header if request.format.atom?
set_guide_draft_access_token if @content_item.is_a?(GuidePresenter)
render_template
Expand Down Expand Up @@ -139,9 +138,7 @@ def set_guide_draft_access_token

def load_content_item
content_item = Services.content_store.content_item(content_item_path)
if Services.feature_toggler.use_recommended_related_links?(content_item["links"], request.headers)
content_item["links"]["ordered_related_items"] = content_item["links"].fetch("suggested_ordered_related_items", [])
end
content_item["links"]["ordered_related_items"] = content_item["links"].fetch("suggested_ordered_related_items", [])

@content_item = PresenterBuilder.new(
content_item,
Expand Down Expand Up @@ -205,14 +202,6 @@ def set_access_control_allow_origin_header
response.headers["Access-Control-Allow-Origin"] = "*"
end

def set_use_recommended_related_links_header
response.headers["Vary"] = [response.headers["Vary"], FeatureFlagNames.recommended_related_links].compact.join(", ")

related_links_request_header = RequestHelper.get_header(FeatureFlagNames.recommended_related_links, request.headers)
required_header_value = Services.feature_toggler.feature_flags.get_feature_flag(FeatureFlagNames.recommended_related_links)
response.headers[FeatureFlagNames.recommended_related_links] = (related_links_request_header == required_header_value).to_s
end

def set_expiry
expires_in(
@content_item.cache_control_max_age(request.format),
Expand Down
6 changes: 0 additions & 6 deletions app/lib/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ def self.content_store
)
end

def self.feature_toggler
@feature_toggler ||= FeatureToggler.new(
HttpFeatureFlags.instance,
)
end

def self.publishing_api
@publishing_api ||= GdsApi::PublishingApi.new(
Plek.find("publishing-api"),
Expand Down
15 changes: 0 additions & 15 deletions app/models/feature_toggler.rb

This file was deleted.

21 changes: 0 additions & 21 deletions app/models/http_feature_flags.rb

This file was deleted.

9 changes: 0 additions & 9 deletions config/initializers/feature_flags.rb

This file was deleted.

66 changes: 0 additions & 66 deletions test/models/feature_toggler_test.rb

This file was deleted.

72 changes: 0 additions & 72 deletions test/models/http_feature_flags_test.rb

This file was deleted.

0 comments on commit dc92468

Please sign in to comment.