1 class MessageController < ApplicationController
3 # before_filter :authorize
4 before_filter :authorize_web
5 before_filter :require_user
9 to_user = User.find_by_display_name(params[:display_name])
10 body = params[:message][:body]
11 title = params[:message][:title]
15 message.to_user_id = to_user.id
16 message.from_display_name = to_user.display_name
17 message.from_user_id = @user.id
18 message.sent_on = Time.now
20 flash[:notice] = 'Message sent'
22 @message.errors.add("Sending message failed")
29 if params[:message_id]
30 id = params[:message_id]
31 @message = Message.find_by_id(id)
36 if params[:message_id]
37 id = params[:message_id]
38 message = Message.find_by_id(id)
39 message.message_read = 1
41 flash[:notice] = 'Message Marked as read'
42 redirect_to :controller => 'user', :action => 'view', :display_name => @user.display_name