Skip to content

[Misc] Move remaining XWiki.XWikiUsers property names to constants#5780

Merged
vmassol merged 3 commits into
masterfrom
claude/sleepy-faraday-qzqmfq
Jul 6, 2026
Merged

[Misc] Move remaining XWiki.XWikiUsers property names to constants#5780
vmassol merged 3 commits into
masterfrom
claude/sleepy-faraday-qzqmfq

Conversation

@vmassol

@vmassol vmassol commented Jul 6, 2026

Copy link
Copy Markdown
Member

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 / validkey through constants. This PR handles the remaining XWiki.XWikiUsers property-name literals that were still hardcoded in XWiki:

  • first_name, last_name — added as public FIRST_NAME_FIELD / LAST_NAME_FIELD constants in XWikiUsersDocumentInitializer (used both in the class initializer and in XWiki), matching the existing EMAIL_FIELD / PASSWORD_FIELD / VALIDKEY_FIELD pattern.
  • active — reuses the pre-existing XWikiUser.ACTIVE_PROPERTY constant (already used elsewhere in XWiki) 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 install on xwiki-platform-oldcore (checkstyle + Spoon) — BUILD SUCCESS.

🤖 Generated with Claude Code


Generated by Claude Code

* 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>
@vmassol vmassol added the llm-agent To be used for PRs created autonomously by LLM agents. label Jul 6, 2026 — with Claude
/**
* The name of the field containing the user first name.
*/
public static final String FIRST_NAME_FIELD = "first_name";

@tmortagne tmortagne Jul 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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>
@tmortagne

tmortagne commented Jul 6, 2026

Copy link
Copy Markdown
Member

XWIKIUSERS_CLASS already have a public version in XWikiUsersDocumentInitializer so it should be reused.

…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>
@vmassol vmassol merged commit c104e13 into master Jul 6, 2026
2 checks passed
@vmassol vmassol deleted the claude/sleepy-faraday-qzqmfq branch July 6, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-agent To be used for PRs created autonomously by LLM agents.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants