Skip to content

refactor: Use RequiredField util for username enforcement in API definition#39292

Merged
ggazzo merged 2 commits intochore/username-apifrom
copilot/sub-pr-39266
Mar 3, 2026
Merged

refactor: Use RequiredField util for username enforcement in API definition#39292
ggazzo merged 2 commits intochore/username-apifrom
copilot/sub-pr-39266

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Replaces the verbose inline type Omit<IUser, 'username'> & Required<Pick<IUser, 'username'>> with the existing RequiredField utility from @rocket.chat/core-typings, as flagged in review.

Changes

  • apps/meteor/app/api/server/definition.ts
    • Import RequiredField from @rocket.chat/core-typings
    • Replace all three occurrences of the inline pattern with RequiredField<IUser, 'username'>
// Before
user: TOptions extends { userWithoutUsername: true } ? IUser : Omit<IUser, 'username'> & Required<Pick<IUser, 'username'>>;

// After
user: TOptions extends { userWithoutUsername: true } ? IUser : RequiredField<IUser, 'username'>;

No behaviour change — RequiredField<T, K> is defined as T & Required<Pick<T, K>>.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Mar 3, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: efb3287

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

…cement

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to enforce username requirement with RequiredField util refactor: Use RequiredField util for username enforcement in API definition Mar 3, 2026
@ggazzo ggazzo marked this pull request as ready for review March 3, 2026 15:03
@ggazzo ggazzo requested a review from a team as a code owner March 3, 2026 15:03
@ggazzo ggazzo merged commit 8af5b98 into chore/username-api Mar 3, 2026
1 check passed
@ggazzo ggazzo deleted the copilot/sub-pr-39266 branch March 3, 2026 15:03
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

ggazzo added a commit that referenced this pull request Mar 3, 2026
…finition (#39292)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
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.

2 participants