EBWiki/EBWiki

View on GitHub
app/controllers/mailbox_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
D
66%
# frozen_string_literal: true

# Mailbox Controller. Part of EBWiki messages
class MailboxController < ApplicationController
  before_action :authenticate_user!
  def inbox
    @inbox = mailbox.inbox
    @active = :inbox
  end

  def sent
    @sent = mailbox.sentbox
    @active = :sent
  end

  def trash
    @trash = mailbox.trash
    @active = :trash
  end

  def after_sign_up_path_for(resource)
    stored_location_for(resource) || super
  end

  def after_sign_in_path_for(resource)
    stored_location_for(resource) || super
  end

  private

  def mailbox
    @mailbox ||= current_user.mailbox
  end
end