You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
552 B
20 lines
552 B
12 months ago
|
class NotificationsController < ApplicationController
|
||
|
def dismiss
|
||
|
if current_user.blank?
|
||
|
redirect_to root_path
|
||
|
else
|
||
|
current_user.newest_active_unread_notification.mark_as_read! for: current_user
|
||
|
redirect_back(fallback_location: root_path)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
@notification = current_user&.newest_active_unread_notification || Notification.newest_active_unauthenticated_notification
|
||
|
if @notification&.page_content
|
||
|
render "show"
|
||
|
else
|
||
|
redirect_back(fallback_location: root_path)
|
||
|
end
|
||
|
end
|
||
|
end
|