Class: MailboxController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- MailboxController
- Defined in:
- app/controllers/mailbox_controller.rb
Instance Method Summary collapse
Instance Method Details
#delete_all ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/controllers/mailbox_controller.rb', line 13 def delete_all current_user.mailbox.inbox.each do |msg| (msg) end empty_trash(current_user) redirect_to sufia.notifications_path end |
#destroy ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/mailbox_controller.rb', line 21 def destroy if current_user msg = Mailboxer::Conversation.find(params[:id]) if (msg.participants[0] == current_user) || (msg.participants[1] == current_user) (msg) empty_trash(msg.participants[0]) end else flash[:alert] = "You do not have privileges to delete the notification..." end redirect_to sufia.notifications_path end |
#index ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/controllers/mailbox_controller.rb', line 4 def index if user_signed_in? @messages = current_user.mailbox.inbox @messages.each{|m| m.mark_as_read(current_user)} else @messages =[] end end |