diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -5,7 +5,8 @@ verify :method => :post, :only => ['create'], :redirect_to => { :action => 'list' } - before_filter :admin_authorization, :only => ['console','show','reply'] + before_filter :admin_authorization, :only => ['console','show', + 'reply','hide'] def list @user = User.find(session[:user_id]) @@ -48,6 +49,14 @@ end end + def hide + message = Message.find(params[:id]) + message.replied = true + message.save + flash[:notice] = 'Message hided (just marked replied)' + redirect_to :action => 'console' + end + protected def build_replying_message_hierarchy(user) @all_messages = {} diff --git a/app/views/messages/_short_message.html.haml b/app/views/messages/_short_message.html.haml --- a/app/views/messages/_short_message.html.haml +++ b/app/views/messages/_short_message.html.haml @@ -4,3 +4,4 @@ %td=h truncate(short_message.body) %td = link_to "[reply]", :action => 'show', :id => short_message.id + = link_to "[hide]", :action => 'hide', :id => short_message.id diff --git a/app/views/messages/show.html.haml b/app/views/messages/show.html.haml --- a/app/views/messages/show.html.haml +++ b/app/views/messages/show.html.haml @@ -11,3 +11,10 @@ = f.hidden_field :receiver_id, {:value => @message.sender_id } = f.hidden_field :replying_message_id, {:value => @message.id } = submit_tag "Post" + +%p + If you do not want to reply, but want to hide this message from + console, you can + = link_to "[hide]", :action => 'hide', :id => @message.id + this message. (This message will be marked as replied.) +