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