Skip to content

Conversation

@AndyButland
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

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.

Copilot AI review requested due to automatic review settings May 7, 2025 06:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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);

@AndyButland
Copy link
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.

Copy link
Contributor

@nikolajlauridsen nikolajlauridsen left a comment

Choose a reason for hiding this comment

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

Looks good, and tests out good manually 👍 Fine with me to fix the unit tests separately 😄

Edit: looks like the tests are already failing on release/16.0

@nikolajlauridsen nikolajlauridsen merged commit 22e0720 into release/16.0 May 7, 2025
18 of 22 checks passed
@nikolajlauridsen nikolajlauridsen deleted the v16/bugfix/log-only-language-iso-codes-to-avoid-exceeding-audit-field-size branch May 7, 2025 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants