mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
18 lines
558 B
Ruby
18 lines
558 B
Ruby
class NotificationsController < ApplicationController
|
|
def index
|
|
@notifications = current_user.notifications.order('happened_at DESC').limit(100)
|
|
end
|
|
|
|
def show
|
|
notification = Notification.find_by(id: params[:id])
|
|
return unless notification.present?
|
|
return unless user_signed_in? && notification.user == current_user
|
|
|
|
# Mark this notification as read
|
|
notification.update(viewed_at: DateTime.current) unless notification.viewed_at?
|
|
|
|
# Redirect to the notification's link
|
|
redirect_to notification.passthrough_link
|
|
end
|
|
end
|