Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't allow to delete message while being sent #539

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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?
jsuchal marked this conversation as resolved.
Show resolved Hide resolved
@message.destroy
redirect_to redirect_path, notice: "Správa bola zahodená"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
redirect_to redirect_path, notice: "Správa bola zahodená"
redirect_to redirect_path, notice: "Správa bola zmazaná"

else
redirect_to redirect_path, alert: "Správu nie je možné zmazať po odoslaní"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luciajanikova je to ze po odoslani alebo pocas odosielania alebo ako to je?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Po zaradeni na odoslanie (tak to volame v aplikacii) - t.j. ani pocas odosielania, ani po odoslani.

end
end

def unlock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def destroy
message_drafts_to_destroy_ids = message_threads.map(&:message_drafts).flatten.map(&:id)

message_threads.transaction do
MessageDraft.where(id: message_drafts_to_destroy_ids).destroy_all
MessageDraft.not_in_submission_process.where(id: message_drafts_to_destroy_ids).destroy_all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luciajanikova nie je toto nejako zavadzajuce, ze oznacis nieco na odoslanie a ono sa to neodosle vlastne (lebo to uz je zaradene na odoslanie). Ci to je by design takto?

end

if message_drafts_to_destroy_ids.present?
Expand Down