Skip to content

Commit

Permalink
Remove feed signup link if licence finder
Browse files Browse the repository at this point in the history
The plan is to remove the feed links from all finders, unless we gain
evidence that it is needed. Until this decision is made, we don't want to
introduce the feature for the new licence finder.

A new generalised method could be implented (not use
`is_licence_transaction?`) if we wanted to do this for a subset of
finders, vs all.
  • Loading branch information
1pretz1 committed Jun 30, 2023
1 parent a45ed6b commit c9fccd5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/presenters/signup_links_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ def email_signup_link
signup_link = content_item.signup_link
return signup_link if signup_link.present?

"#{content_item.email_alert_signup['base_path']}#{query_string(alert_query_params)}" if content_item.email_alert_signup
if content_item.email_alert_signup
"#{content_item.email_alert_signup['base_path']}#{query_string(alert_query_params)}"
end
end

def feed_link
"#{content_item.base_path}.atom#{query_string(alert_query_params.merge(keywords:))}"
unless content_item.is_licence_transaction?
"#{content_item.base_path}.atom#{query_string(alert_query_params.merge(keywords:))}"
end
end

def alert_query_params
Expand Down
4 changes: 3 additions & 1 deletion app/views/finders/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<% content_for :title, content_item.title %>
<% end %>
<% content_for :head do %>
<%= auto_discovery_link_tag(:atom, signup_links[:feed_link]) %>
<% if signup_links[:feed_link] %>
<%= auto_discovery_link_tag(:atom, signup_links[:feed_link]) %>
<% end %>
<%= render 'finder_meta', content_item: content_item %>
<% end %>
Expand Down
14 changes: 14 additions & 0 deletions spec/presenters/signup_link_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@
expect(subject.signup_links[:feed_link]).to eql("/mosw-reports.atom?keywords=micropig&topic%5B%5D=hidden_facet_content_id")
end
end

context "with a licence transaction" do
let(:facet_values) do
[]
end

before do
allow(content_item).to receive(:is_licence_transaction?).and_return(true)
end

it "returns nil" do
expect(subject.signup_links[:feed_link]).to be nil
end
end
end
end
end

0 comments on commit c9fccd5

Please sign in to comment.