-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Review: Bug fix#17149 User Validation on Audit Repository .Save Method #17248
Conversation
Hi there @IbrahimMNada, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
Hey @IbrahimMNada, thanks for making a PR to fix this 🎉 Someone from the team will get this reviewed and get back to you soon. |
Any update on this |
Hello @IbrahimMNada, Apologies for the delayed answer 😅 So it would be super great if you could check how that would work out😁 Cheers! |
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 suggestion.
Comments skipped due to low confidence (1)
src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditRepository.cs:197
- [nitpick] The error message 'The user id does not exist' could be more descriptive. Suggestion: 'The specified user ID does not exist in the database.'
new { id = entity.UserId }) ?? throw new InvalidOperationException("The user id does not exist");
src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditRepository.cs
Outdated
Show resolved
Hide resolved
I have no problem injecting the IUserService in the Audit repository , plus if we go with services we lose the caching , which in my experience is gonna be useful since most of the time me or the people I know used content services mostly for migration/bulk transitions. but never the less its you call , i'm ready to change it |
Woopsie my bad, I did not pay attention to the fact that it was a Repository 😅 Then it's indeed fine 👍 |
Hi again @IbrahimMNada , I took, a further look, it all works fine, thanks a lot 👍 Before merging, I wanted to suggest trying to get rid of the hardcoded SQL statement, which can turn out tricky to maintain (aka we forgot about them😅 ) through time and maybe try to take inspiration from what is done in the This could give like the code below (not tested), which I think would be easier to maintain if some DB related things change through time.
Would you maybe be up for trying this approach 😁? No problem if you don't have the time to, then I'll merge your code as-is 👍 Cheers! |
Not a Problem |
Done , I have changed it to follow Npoco annotations , made the method more reusable/overridable for other consumers manually tested it , working as expected |
Hello 👋 We want to fix this in the We will mark the issue as a sprint candidate, so this works goes in our backlog. |
Description
If there's an existing issue for this PR then this fixes #17149
this pull request is a fix for this issue : #17149
Which states that a content publish can be established using
ContentService
with a non existing user.A Simple Database Validation/ and simple caching mechanism were added in order to check if the user really exists in the database
This item has been added to our backlog AB#46955