Sha256: 2a4d345a43212c8a66056d9b1e432b53c8afa4b78cc0e6036bfba70e58ff9dc8

Contents?: true

Size: 980 Bytes

Versions: 25

Compression:

Stored size: 980 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  class NotificationsController < ApplicationController
    before_action :authenticate_user!
    with_themed_layout 'dashboard'

    def index
      add_breadcrumb t(:'hyrax.controls.home'), root_path
      add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
      add_breadcrumb t(:'hyrax.admin.sidebar.notifications'), hyrax.notifications_path
      @messages = user_mailbox.inbox
      # Update the notifications now that there are zero unread
      StreamNotificationsJob.perform_later(current_user)
    end

    def delete_all
      user_mailbox.delete_all
      redirect_to hyrax.notifications_path, alert: t('hyrax.mailbox.notifications_deleted')
    end

    def destroy
      message_id = params[:id]
      alert = user_mailbox.destroy(message_id)
      redirect_to hyrax.notifications_path, alert: alert
    end

    private

    def user_mailbox
      UserMailbox.new(current_user)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hyrax-3.0.1 app/controllers/hyrax/notifications_controller.rb
hyrax-3.0.0 app/controllers/hyrax/notifications_controller.rb
hyrax-3.0.0.pre.rc4 app/controllers/hyrax/notifications_controller.rb
hyrax-3.0.0.pre.rc3 app/controllers/hyrax/notifications_controller.rb
hyrax-3.0.0.pre.rc2 app/controllers/hyrax/notifications_controller.rb