app/controllers/mailbox_controller.rb in sufia-3.4.0 vs app/controllers/mailbox_controller.rb in sufia-3.5.0

- old
+ new

@@ -2,34 +2,34 @@ before_filter :authenticate_user! def index if user_signed_in? @messages = current_user.mailbox.inbox - current_user.mark_as_read @messages + @messages.each{|m| m.mark_as_read(current_user)} else @messages =[] end end def delete_all current_user.mailbox.inbox.each do |msg| delete_message(msg) end empty_trash(current_user) - redirect_to sufia.mailbox_path + redirect_to sufia.notifications_path end - def delete - if (current_user) - msg = Conversation.find(params[:uid]) + def destroy + if current_user + msg = Conversation.find(params[:id]) if (msg.participants[0] == current_user) || (msg.participants[1] == current_user) delete_message(msg) empty_trash(msg.participants[0]) end - else + else flash[:alert] = "You do not have privileges to delete the notification..." - end - redirect_to sufia.mailbox_path + end + redirect_to sufia.notifications_path end private def delete_message (msg)