-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
don't allow to delete message while being sent #539
Conversation
@jsuchal @luciajanikova riesenie #522 |
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á" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redirect_to redirect_path, notice: "Správa bola zahodená" | |
redirect_to redirect_path, notice: "Správa bola zmazaná" |
@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í" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardlences vies tu pridat aj test na toto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pozri komenty
@richardlences zvladnes/skusit pridat aj test? Ak nie, povedz, mozem dorobit aj ja. |
Skusim pridat, dam vediet ak mi to nepojde |
session[:user_id] = Current.user.id | ||
end | ||
test "should destroy draft with status created" do | ||
# draft should be destroyed if not yet submitted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tento koment mal byt vlastne nazov testu.
@@ -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 |
There was a problem hiding this comment.
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?
No description provided.