Skip to content

chore: replace getLoggedInUser with this.user in API endpoints#38858

Merged
ggazzo merged 5 commits into
developfrom
copilot/refactor-get-logged-in-user-endpoints
Feb 21, 2026
Merged

chore: replace getLoggedInUser with this.user in API endpoints#38858
ggazzo merged 5 commits into
developfrom
copilot/refactor-get-logged-in-user-endpoints

Conversation

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Replace manual getLoggedInUser(this.request) calls with the framework-provided this.user/this.userId context properties.

Changes

  • groups.online, channels.online: Use this.user directly (authRequired: true guarantees user exists)
  • commands.preview: Use this.userId directly
  • shield.svg, info: Use this.user/this.userId with authRequired: false — optional but populated when valid token provided
  • Deleted getLoggedInUser.ts helper and its import from index.ts

Before/After

// Before
const user = await getLoggedInUser(this.request);
if (!user) return API.v1.failure('User does not exists');
if (!(await canAccessRoomAsync(room, user))) { ... }

// After
if (!(await canAccessRoomAsync(room, this.user))) { ... }

For authRequired: false endpoints:

// this.user is optional, populated when valid credentials provided
if (settings.get('API_Shield_user_require_auth') && !this.user) {
  return API.v1.failure('You must be logged in to do this.');
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Task: ARCH-1981

@dionisio-bot

dionisio-bot Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

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

  • This PR is targeting the wrong base branch. It should target 8.3.0, but it targets 8.2.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Feb 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: abc2d02

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

@ggazzo ggazzo added this to the 8.3.0 milestone Feb 20, 2026
Copilot AI and others added 3 commits February 20, 2026 21:51
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor endpoints to use this.user instead of getLoggedInUser chore: replace getLoggedInUser with this.user in API endpoints Feb 20, 2026
Copilot AI requested a review from ggazzo February 20, 2026 21:55
@codecov

codecov Bot commented Feb 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.57%. Comparing base (a0285d1) to head (abc2d02).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38858      +/-   ##
===========================================
+ Coverage    70.55%   70.57%   +0.02%     
===========================================
  Files         3188     3189       +1     
  Lines       112666   112703      +37     
  Branches     20395    20416      +21     
===========================================
+ Hits         79494    79543      +49     
+ Misses       31113    31098      -15     
- Partials      2059     2062       +3     
Flag Coverage Δ
e2e 60.38% <ø> (+0.02%) ⬆️
e2e-api 47.86% <ø> (+0.05%) ⬆️
unit 71.55% <ø> (-0.01%) ⬇️

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

🚀 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.

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
@ggazzo ggazzo marked this pull request as ready for review February 21, 2026 03:45
@ggazzo ggazzo requested a review from a team as a code owner February 21, 2026 03:45

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 7 files

@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Feb 21, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Feb 21, 2026
@ggazzo

ggazzo commented Feb 21, 2026

Copy link
Copy Markdown
Member

/jira ARCH-1935

@ggazzo ggazzo merged commit 27448fe into develop Feb 21, 2026
50 checks passed
@ggazzo ggazzo deleted the copilot/refactor-get-logged-in-user-endpoints branch February 21, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants