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

Allow deletion of api keys with media #2044

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

jayjay-w
Copy link
Contributor

Description

Allow deletion of API keys even if the key's user has been used to create media.

References: CV2-5096

How has this been tested?

Tested in the UI using these steps:

  1. Create an Api Key
  2. Use the token to create project media
  3. Confirm that the Api Key can be deleted

Checklist

  • I have performed a self-review of my own code
  • I have added unit and feature tests, if the PR implements a new feature or otherwise would benefit from additional testing
  • I have added regression tests, if the PR fixes a bug
  • I have added logging, exception reporting, and custom tracing with any additional information required for debugging
  • I considered secure coding practices when writing this code. Any security concerns are noted above.
  • I have commented my code in hard-to-understand areas, if any
  • I have made needed changes to the README
  • My changes generate no new warnings
  • If I added a third party module, I included a rationale for doing so and followed our current guidelines

Allow deletion of API keys even if the key's user has been used to create media.
@jayjay-w jayjay-w force-pushed the CV2-5096-allow-delete-api-key-with-media branch from ce42e87 to c6177a2 Compare September 23, 2024 16:46
@jayjay-w jayjay-w marked this pull request as ready for review September 23, 2024 18:27
if bot_user.present? && bot_user.owns_media?
bot_user.update(api_key_id: nil)
else
bot_user.destroy
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note that I would suggest a test for this case but I see that the coverage is still 100% so it's already covered by some other test.

@jayjay-w jayjay-w merged commit 27270fc into develop Sep 24, 2024
10 checks passed
@jayjay-w jayjay-w deleted the CV2-5096-allow-delete-api-key-with-media branch October 6, 2024 15:24
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.

3 participants