2021-09-24 11:58:42 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CustomWizard::AdminNoticeController < CustomWizard::AdminController
|
|
|
|
before_action :find_notice, only: [:dismiss]
|
|
|
|
|
|
|
|
def index
|
2021-10-05 14:54:06 +02:00
|
|
|
render_serialized(CustomWizard::Notice.list(include_recently_expired: true), CustomWizard::NoticeSerializer)
|
2021-09-24 11:58:42 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def dismiss
|
|
|
|
if @notice.dismissable? && @notice.dismiss
|
|
|
|
render json: success_json.merge(dismissed_at: @notice.dismissed_at)
|
|
|
|
else
|
|
|
|
render json: failed_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_notice
|
|
|
|
@notice = CustomWizard::Notice.find(params[:notice_id])
|
|
|
|
raise Discourse::InvalidParameters.new(:notice_id) unless @notice
|
|
|
|
end
|
2021-10-05 14:54:06 +02:00
|
|
|
end
|