Skip to content

Commit

Permalink
Merge branch 'master' into master-legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
thatandromeda committed Aug 30, 2019
2 parents dbbd77b + c567ba6 commit 15d6a83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def active_advanced_search_parameters?
end

def can_see_full_notice_version?(notice)
return true if can?(:view_full_version, notice)
whitelisted_notices = (ENV['WHITELISTED_NOTICES_FULL'] || []).split(',')

return true if can?(:view_full_version, notice) ||
whitelisted_notices.include?(notice.id.to_s)

TokenUrl.valid?(params[:access_token], notice)
end
Expand Down
8 changes: 8 additions & 0 deletions spec/integration/viewing_notices.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
check_full_works_urls
end

scenario 'as an anonymous user viewing whitelisted notice' do
ENV['WHITELISTED_NOTICES_FULL'] = "1234,#{Notice.last.id}"

visit notice_url(Notice.last)

check_full_works_urls
end

def check_full_works_urls
within('#works') do
expect(page).to have_content 'http://www.example.com/original_work.pdf'
Expand Down

0 comments on commit 15d6a83

Please sign in to comment.