blob: fdde395fc98f48d0c1986dfacf85e32e745dfadf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class MessagesController < ApplicationController
def index
@messages = Message.where(recipient: current_char).order(created_at: :desc)
end
def destroy
@message = Message.find(params[:id])
if @message.recipient == current_char
if @message.destroy
flash[:notice] = "Deleted message."
else
flash[:alert] = "Failed to delete message. Please report this bug."
end
else
flash[:alert] = "You can't delete someone else's message."
end
redirect_to messages_path
end
end
|