Skip to content

Commit

Permalink
don't allow to delete message while being sent
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlences committed Jan 28, 2025
1 parent ad1006b commit ebbb7d1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/controllers/message_drafts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ def destroy
# redirect_path = @message.original_message.present? ? message_thread_path(@message.original_message.thread) : message_drafts_path
redirect_path = @message.original_message.present? ? message_thread_path(@message.original_message.thread) : message_threads_path

@message.destroy

redirect_to redirect_path, notice: "Správa bola zahodená"
if @message.not_yet_submitted?
@message.destroy
redirect_to redirect_path, notice: "Správa bola zahodená"
else
redirect_to redirect_path, alert: "Správu nie je možné zmazať po odoslaní"
end
end

def unlock
Expand Down

0 comments on commit ebbb7d1

Please sign in to comment.