Skip to content

Add deletion of uploaded images #257

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

Closed
jschulzaqua opened this issue Jan 9, 2024 · 6 comments · Fixed by #374
Closed

Add deletion of uploaded images #257

jschulzaqua opened this issue Jan 9, 2024 · 6 comments · Fixed by #374
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jschulzaqua
Copy link

If you upload images, you can unfortunately no longer remove them from the selection.
Is there a solution for this?

Screenshot 2024-01-09 132604

@wmnnd
Copy link
Contributor

wmnnd commented Jan 10, 2024

There’s currently no way to delete files because before adding this feature, I wanted to add a check whether a file is currently in use in another campaign. But this is definitely something for the to-do list!

@wmnnd wmnnd changed the title Delete images from my selection Add deletion of uploaded images Jan 10, 2024
@wmnnd wmnnd added the enhancement New feature or request label Jan 10, 2024
@github-project-automation github-project-automation bot moved this to Inbox & Ideas in Roadmap to 1.0 Aug 30, 2024
@wmnnd wmnnd added the good first issue Good for newcomers label Dec 3, 2024
@wmnnd wmnnd moved this from Inbox & Ideas to Ready to implement in Roadmap to 1.0 Dec 3, 2024
@wmnnd
Copy link
Contributor

wmnnd commented Jan 15, 2025

Hey there, thanks for giving this a shot!

One of the reasons (as mentioned in #374) why I hadn't implemented this feature yet is that I think there should be a check whether an image is still in use in other campaigns. There should be a warning when deleting an image that's still in use somewhere because it might break campaigns that have already been sent (bad) or campaigns that have been created but not yet sent (not quite as bad but still not good).

I was thinking we should add something like Keila.Mailings.search_in_project_campaigns(project_id, string). Then this function should search for the given string in text_body, mjml_body, html_bodyand json_body. You could then use this function to check if there are any campaigns where the full path or the UUID of the file occurs.
Let me know what you think and if you'd like to try your hand at this as well!

Another thing you should do is make sure the user has permission to delete the file they're trying to delete. To do that, you could add Keila.Files.get_project_file(project_id, file_id) to ensure the UUID sent by the user is part of their project. Only if it does exist, should you call delete_file/2.

@jrowah
Copy link
Contributor

jrowah commented Jan 16, 2025

Hey, thank you for responding.

I think your idea of implementation is better. I would like to give it a shot and will let you know if I think of something.
I also missed the security measure you mentioned in the last part, I am on to that as well.

@wmnnd
Copy link
Contributor

wmnnd commented Jan 16, 2025

Awesome! Let me know if you come across anything where I can help 😊

@MrSnoozles
Copy link

MrSnoozles commented Jan 17, 2025

@wmnnd Would it be easier to manage if images get copied (either to another directory or they get a "keila-sent-" prefix) as soon as the campaign is being sent out? Then all the uploaded images could be deleted. If they are used in a campaign the copy is still there.

(That would not work for campaigns already sent before the release of this feature though, but since Keila hasn't reached 1.0 yet that might be okay?)

@wmnnd
Copy link
Contributor

wmnnd commented Jan 17, 2025

Thanks for the idea @MrSnoozles. I think It might be the better solution in the long run but I don't think implementing it makes sense before #355 is complete.

@wmnnd wmnnd closed this as completed in #374 Feb 4, 2025
@github-project-automation github-project-automation bot moved this from Ready to implement to Done in Roadmap to 1.0 Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants