Class: MailboxController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- MailboxController
- Defined in:
- app/controllers/mailbox_controller.rb
Overview
Copyright © 2012 The Pennsylvania State University
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Instance Method Summary collapse
Instance Method Details
#delete ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/mailbox_controller.rb', line 36 def delete if (current_user) msg = Conversation.find(params[:uid]) 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.mailbox_path end |
#delete_all ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/controllers/mailbox_controller.rb', line 28 def delete_all current_user.mailbox.inbox.each do |msg| (msg) end empty_trash(current_user) redirect_to sufia.mailbox_path end |
#index ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/mailbox_controller.rb', line 18 def index if user_signed_in? inbox = current_user.mailbox.inbox @messages = inbox.all current_user.mark_as_read @messages else @messages =[] end end |