1
0
mirror of https://github.com/discourse/discourse.git synced 2025-03-09 14:34:35 +00:00
Ted Johansson be33363f13
FEATURE: Add ability to dismiss admin notices ()
his is a new feature that lets admins dismiss notices from the dashboard. This helps with self-service in cases where a notice is "stuck", while we work on provisions to prevent "sticking" in the first place.
2024-09-17 14:43:34 +08:00

33 lines
536 B
Ruby

# frozen_string_literal: true
class AdminNotices::Dismiss
include Service::Base
model :admin_notice
policy :invalid_access
transaction do
step :destroy
step :reset_problem_check
end
private
def fetch_admin_notice(id:)
AdminNotice.find_by(id: id)
end
def invalid_access(guardian:)
guardian.is_admin?
end
def destroy(admin_notice:)
admin_notice.destroy!
end
def reset_problem_check(admin_notice:)
ProblemCheckTracker.find_by(identifier: admin_notice.identifier)&.reset
end
end