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

Cascade delete email items, when deleting activity (e.g. invitations) #1073

Closed

Conversation

rasmusselsmark
Copy link
Contributor

Løser #1040

Ved sletning af aktivitet uden deltagere, slettes evt udsendte e-mails også. Det er ikke muligt at slette en aktivitet som har tilmeldinger.

Dette betyder dog link i invitation ikke længere er gyldig, er det et problem?

Copy link

what-the-diff bot commented Jul 21, 2024

PR Summary

  • New Migration File 0055_alter_emailitem_activity.py
    This PR includes an addition of a new migration file. With this file, changes will be applied to the emailitem table in the database. Specifically, it modifies how the table deals with the deletion of 'activity' fields. Now, when an 'activity' is deleted, the corresponding 'emailitem' will also be automatically deleted, which previously was not the case.

  • Changed Deletion Behavior in emailitem.py
    There is an update to the emailitem model in the emailitem.py file. The relationship between 'emailitem' and 'activity' is now set to CASCADE on deletion, which means that when an 'activity' is deleted, its related 'emailitem' will also get deleted. This replaces the previous logic where no action was taken (DO_NOTHING) on the deletion of an 'activity'.

@rasmusselsmark
Copy link
Contributor Author

Vi skal ikke slette hvis der er sendt invitationer ud, men vise besked om at det ikke er muligt

Copy link
Contributor

@lakridserne lakridserne left a comment

Choose a reason for hiding this comment

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

Du bør ikke kunne slette en aktivitet, hvis der allerede er udsendt invitationer. Hvis du kan det, vil det slette invitationerne, og forældrene vil have udfordringer med at acceptere invitationerne og være nødt til at kontakte sekretairatet. Man kunne for eksempel forestille sig at en afdelingskaptajn har lavet en fejl, og fjerner aktiviteten og laver en ny, men da invitationerne allerede er sendt ud via email, vil det forvirre at linket er ugyldigt.

@rasmusselsmark
Copy link
Contributor Author

Lukker dette PR igen, vi finder en løsning hvor der gives en pænere fejlbesked hvis man forsøger at slette (men det er ikke muligt at slette)

@rasmusselsmark rasmusselsmark deleted the 1040-cascade-delete-emailitems-on-activity-delete branch August 31, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants