1 class MessageController < ApplicationController
3 # before_filter :authorize
4 before_filter :authorize_web
5 before_filter :require_user
8 @title = 'send message'
10 to_user = User.find(params[:user_id])
11 body = params[:message][:body]
12 title = params[:message][:title]
16 message.to_user_id = params[:user_id]
17 message.from_display_name = to_user.display_name
18 message.from_user_id = @user.id
19 message.sent_on = Time.now
22 flash[:notice] = 'Message sent'
23 redirect_to :controller => 'user', :action => 'view', :display_name => @user.display_name
25 @message.errors.add("Sending message failed")
32 @title = 'read message'
33 if params[:message_id]
34 id = params[:message_id]
35 @message = Message.find_by_id(id)
43 if params[:message_id]
44 id = params[:message_id]
45 message = Message.find_by_id(id)
46 message.message_read = 1
48 flash[:notice] = 'Message Marked as read'
49 redirect_to :controller => 'user', :action => 'view', :display_name => @user.display_name