Log language ISO codes instead of language names#19259
Merged
nikolajlauridsen merged 1 commit intorelease/16.0from May 7, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request changes audit log messages to use ISO language codes instead of full language names in order to avoid exceeding field sizes.
- Updated tests to assert ISO code strings in log messages
- Modified ContentService to utilize GetLanguageDetailsForAuditEntry for generating log language details
- Removed an unused dependency in ContentServiceTests
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentServiceTests.cs | Updated assertions and removed unused service dependency |
| src/Umbraco.Core/Services/ContentService.cs | Replaced language name selection with a new helper method for ISO codes and updated audit log calls |
Comments suppressed due to low confidence (1)
src/Umbraco.Core/Services/ContentService.cs:3087
- Consider adding a null-check or using a null-conditional operator on _languageRepository.GetMany() to avoid potential null reference exceptions.
private string GetLanguageDetailsForAuditEntry(IEnumerable<string> affectedCultures) => GetLanguageDetailsForAuditEntry(_languageRepository.GetMany(), affectedCultures);
Contributor
Author
|
Some failing unit tests in here I see - but looks like they are unrelated. I'll look to resolve in a separate PR. |
nikolajlauridsen
approved these changes
May 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Resolves #19252
Description
The linked issue shows that for sites with lots of languages, we can overrun the available field size when logging the details of a save or publish operation. I've resolved this by recognising that we don't really need to log the full language name. The ISO code is sufficient and more consistent to be able to identify it, and is much shorter.
I realised having completed this we already had a partial fix from #15263 - but this was only for new installs, so we could have more upgrade sites in future that run into this. Hence I still felt it was worth changing what we log here.
Although only logging, it's theoretically a behavioural breaking change - perhaps someone was relying on and already parsing this log entries? - so it would make sense in a major release, hence targeted for 16.