Skip to content

fix: username field is not populated by exact input#145

Open
MusaleTejas wants to merge 2 commits into
rtCamp:mainfrom
MusaleTejas:fix/username-exact-input
Open

fix: username field is not populated by exact input#145
MusaleTejas wants to merge 2 commits into
rtCamp:mainfrom
MusaleTejas:fix/username-exact-input

Conversation

@MusaleTejas

Copy link
Copy Markdown

Description

This PR resolves the issue where the username field on the OneAccess dashboard does not display the exact username/login of the user, falling back instead to the prefix of their email address (email.split('@')[0]).

To address this, we now synchronize and store the actual WordPress user_login inside the sites_info JSON database field for each site, retrieve it during REST queries, and display the exact username in the frontend interface.

Changes

  • Backend Syncing (inc/Modules/Rest/Actions_Controller.php): Included username in prepare_user_data and sanitized it in sanitize_user_data.
  • Database Helper (inc/Modules/Core/DB.php): Added support for username inside sites_info JSON during user insertion, updates, and manually mapped users.
  • REST Controller (inc/Modules/Rest/Governing_Site_Controller.php): Extracted the exact username from sites_info and exposed it at the user level in the get_users API response.
  • Frontend Dashboard (assets/src/components/SharedUsers.tsx): Updated SharedUser interface and transformed the API response mapping to render user.username (with the email split as a fallback for legacy records).

@MusaleTejas MusaleTejas changed the title Fix: Username field is not populated by exact input fix: username field is not populated by exact input Jul 9, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.78%. Comparing base (d005570) to head (434209c).

Files with missing lines Patch % Lines
inc/Modules/Rest/Governing_Site_Controller.php 0.00% 10 Missing ⚠️
inc/Modules/Core/DB.php 0.00% 3 Missing ⚠️
inc/Modules/Rest/Actions_Controller.php 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              main    #145      +/-   ##
==========================================
- Coverage     6.81%   6.78%   -0.04%     
- Complexity     601     604       +3     
==========================================
  Files           20      20              
  Lines         3036    3050      +14     
==========================================
  Hits           207     207              
- Misses        2829    2843      +14     
Flag Coverage Δ
unit 6.78% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
inc/Modules/Rest/Actions_Controller.php 0.00% <0.00%> (ø)
inc/Modules/Core/DB.php 0.00% <0.00%> (ø)
inc/Modules/Rest/Governing_Site_Controller.php 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants