Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-14 05:52:52 +01:00
22 Zeilen
633 B
Ruby
22 Zeilen
633 B
Ruby
# frozen_string_literal: true
|
|
|
|
class CustomWizard::AdminNoticeController < CustomWizard::AdminController
|
|
before_action :find_notice, only: [:dismiss]
|
|
|
|
def index
|
|
render_serialized(CustomWizard::Notice.list(include_recently_expired: true), CustomWizard::NoticeSerializer)
|
|
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
|
|
end
|