[Misc] Move remaining XWiki.XWikiUsers property names to constants#5780
Merged
Conversation
* Follow-up to the SonarCloud S1192 fix: route the remaining hardcoded XWiki.XWikiUsers property-name literals in XWiki through constants. * Add public FIRST_NAME_FIELD / LAST_NAME_FIELD constants in XWikiUsersDocumentInitializer and use them (in the class initializer and in XWiki). * Reuse the existing XWikiUser.ACTIVE_PROPERTY constant for the "active" property instead of duplicating the literal. Co-Authored-By: Vincent Massol <vincent@massol.net>
tmortagne
reviewed
Jul 6, 2026
| /** | ||
| * The name of the field containing the user first name. | ||
| */ | ||
| public static final String FIRST_NAME_FIELD = "first_name"; |
Member
There was a problem hiding this comment.
Missing @since (also on others recently introduced public fields).
…lizer public fields * Document FIRST_NAME_FIELD/LAST_NAME_FIELD and the EMAIL_FIELD/ PASSWORD_FIELD/VALIDKEY_FIELD constants with @SInCE 18.6.0RC1. Co-Authored-By: Vincent Massol <vincent@massol.net>
Member
|
XWIKIUSERS_CLASS already have a public version in |
…XWiki * Drop the local XWIKIUSERS_CLASS constant in favor of the existing public XWikiUsersDocumentInitializer.CLASS_REFERENCE_STRING. Co-Authored-By: Vincent Massol <vincent@massol.net>
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.
Summary
Follow-up to #5779 (merged), addressing tmortagne's review comment: "there was a lot of other stuff that should have moved to XWikiUsersDocumentInitializer."
That PR routed only
email/password/validkeythrough constants. This PR handles the remainingXWiki.XWikiUsersproperty-name literals that were still hardcoded inXWiki:first_name,last_name— added as publicFIRST_NAME_FIELD/LAST_NAME_FIELDconstants inXWikiUsersDocumentInitializer(used both in the class initializer and inXWiki), matching the existingEMAIL_FIELD/PASSWORD_FIELD/VALIDKEY_FIELDpattern.active— reuses the pre-existingXWikiUser.ACTIVE_PROPERTYconstant (already used elsewhere inXWiki) rather than introducing a duplicate in the initializer.Scope
The sweep is scoped to
XWiki.java(where the review comments were anchored); those three were the only genuine user-property literals still hardcoded there (the remaining"skin"occurrences are the skin action, not the user property). Happy to widen to other classes if wanted.Test plan
mvn clean installonxwiki-platform-oldcore(checkstyle + Spoon) — BUILD SUCCESS.🤖 Generated with Claude Code
Generated by Claude Code