docbrown/app/controllers/billboards_controller.rb
Ridhwana 272aea6127
Allow admins to delete an organization (#19699)
* feat: update the layout for organizations

* feat: update the layout for an organization

* feat: organization logos are square

* feat: change the text on the org visit button

* feat: initialize the dropdown menu

* feat: trigger the  modal

* feat: update the text in the model

* feat: tweak wording

* WIP/feat: hook up a route with an action that calls an organization delete worker.

* feat: redirect after showing the notice

* feat: update the authorization required to be super admin

* feat: add the notice to localization

* spec: integration test

* spec: fix

* spec: delete worker

* chore: update the link

* feat: add safe navigation

* feat: make sure that we show an error if the organization has credits

* fix: error message for modal unspent credits

* feat add the spec for the helper

* fix: remove rspec preface

* fix: small fixes to tests and I18n

* fix: updated the number of orgs

* feat: update the message

* feat: update the message

* chore: remove inclusion of helper

* feat: change the name of the parameter

* chore: newline
2023-07-17 12:09:24 +02:00

42 lines
1.1 KiB
Ruby

class BillboardsController < ApplicationController
before_action :set_cache_control_headers, only: %i[show], unless: -> { current_user }
include BillboardHelper
CACHE_EXPIRY_FOR_DISPLAY_ADS = 15.minutes.to_i.freeze
def show
skip_authorization
set_cache_control_headers(CACHE_EXPIRY_FOR_DISPLAY_ADS) unless session_current_user_id
if placement_area
if params[:username].present? && params[:slug].present?
@article = Article.find_by(slug: params[:slug])
end
@display_ad = DisplayAd.for_display(
area: placement_area,
user_signed_in: user_signed_in?,
user_id: current_user&.id,
article: @article ? ArticleDecorator.new(@article) : nil,
user_tags: user_tags,
)
if @display_ad && !session_current_user_id
set_surrogate_key_header @display_ad.record_key
end
end
render layout: false
end
private
def placement_area
params[:placement_area]
end
def user_tags
return unless feed_targeted_tag_placement?(placement_area)
current_user&.cached_followed_tag_names
end
end