Sha256: c2a6559f0a3a40081872ef8f88e5b973d91e06f7104ab8c617887e0039c6ad81

Contents?: true

Size: 978 Bytes

Versions: 56

Compression:

Stored size: 978 Bytes

Contents

module Comee
  module Core
    class NotificationsController < ApplicationController
      before_action :set_notification, only: %i[mark_as_read mark_as_unread]

      def index
        data = Notification.messages(current_user.notifications.newest_first)
        render_content(data)
      end

      def read
        data = Notification.messages(current_user.notifications.read.newest_first)
        render_content(data)
      end

      def unread
        data = Notification.messages(current_user.notifications.unread.newest_first)
        render_content(data)
      end

      def mark_as_read
        @notification.mark_as_read!
        render json: {success: true, data: @notification.message}
      end

      def mark_as_unread
        @notification.mark_as_unread!
        render json: {success: true, data: @notification.message}
      end

      private

      def set_notification
        @notification = Notification.find(params[:id])
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
comee_core-0.2.52 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.51 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.50 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.49 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.48 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.47 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.46 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.45 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.44 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.43 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.42 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.41 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.40 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.39 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.38 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.37 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.36 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.35 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.34 app/controllers/comee/core/notifications_controller.rb
comee_core-0.2.33 app/controllers/comee/core/notifications_controller.rb