Skip to content

Dev to Main Sync#2428

Merged
iamitprakash merged 19 commits intomainfrom
develop
Jul 19, 2025
Merged

Dev to Main Sync#2428
iamitprakash merged 19 commits intomainfrom
develop

Conversation

@Achintya-Chatterjee
Copy link
Contributor

@Achintya-Chatterjee Achintya-Chatterjee commented May 20, 2025

Date: June 30, 2025

Developer Name: @AnujChhikara @pankajjs @Suvidh-kaushik


Issue Ticket Number

PR's Going in this Sync

Description

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1
  • as you can see I have marked my task status approved and you can see in the api that fetch users with overdue task I am getting mention
Anuj.task.mp4

Test Coverage

Screenshot 1

Additional Notes

Description by Korbit AI

What change is being made?

Implement user impersonation feature with token-based authentication, new routes, middleware for validating and authorizing impersonation sessions, and extensive test suite integration.

Why are these changes being made?

To enable superusers to impersonate other users, allowing for better troubleshooting and user support. This involves creating, updating, and managing impersonation requests, with security handled via JWT tokens. The comprehensive test suite ensures functionality remains robust and errors are caught early.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

* fix: return correct users with overdue tasks in APPROVED status

* refactor : add mock data in task fixture

---------

Co-authored-by: Achintya Chatterjee <55826451+Achintya-Chatterjee@users.noreply.github.com>
@coderabbitai
Copy link

coderabbitai bot commented May 20, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

* added types file for impersonation Requests

* all types and constants required for impersonation

* fixed constants and types according to review comments

* updated isImpersonationStarted field to isImpersonationFinished
* feat: Add short-circuit middleware to disable invite routes temporarily

* fix: Temporarily skip tests for invite routes in Discord actions

* fix: Correct wording in server unavailable message for disabled route
* feat: add Discord service verification and token generation

* refactor: update test descriptions for discord service authorization

* fix: handle missing x-service-name header in Discord bot verification

* fix: correct discord service public key configuration

* fix: update discord service private key configuration in token generation

* fix: use HEADERS constant for service name in Discord bot authorization

* refactor: update description for discord service authorization tests

* fix: update test description for unauthorized token handling in discord service

* fix: update service name in authorization test for cloudflare worker

* fix: remove unused import in authorizeBot test file

* fix: update verifyDiscordBot tests to remove unused response object

* fix: update discord service authorization test to check for unauthorized response

* fix: refactor response handling in discord service authorization tests

* chore: fix assert statement

* chore: fix import statement

* chore: remove duplicate test name

* refactor: add logic to handle discord service verification

* refactor: remove nested if conditions

* fix: handle verification based on header

---------

Co-authored-by: Pankaj <pankajshadev@gmail.com>
* feat: Add discordServicePublicKey to botToken configuration

* feat: Add discordServicePublicKey to botToken configuration

* refactor: Remove DISCORD_SERVICE constant from bot configuration

* refactor: Rename discordServiceToken to discordService and update publicKey structure

---------

Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
* added model,route, controller and service for creation

* optimized create query handling

* removed rate-limiter imports

* fixed types in controllers and services

* fixed query used for creating the request

* fixed: small query updates and updated dev flag

* fixed status type and 403 forbidden error

---------

Co-authored-by: Achintya Chatterjee <55826451+Achintya-Chatterjee@users.noreply.github.com>
* added unit fixtures and tests for services, controller and middleware

* fixed small comments and lint fixes

* fixed tests according to route logic changes

* removed unecessary any type from the file

* fixed test descriptions

* removed any type from variables

* chore: fixed variable declerations in tests

* fixed unit tests by adding stubs

* chore: fixed req and res type in middleware tests

* removed uneccessary beforeEach from services

* fixed forbidden error response in tests

---------

Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
* added integration tests for create impersonation requests

* nitpick: fixed small spacing issues and linting

* fixed integration tests according to logic changes

* fixed test descriptions

* fixed error response in tests

---------

Co-authored-by: Achintya Chatterjee <55826451+Achintya-Chatterjee@users.noreply.github.com>
Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
…equests

feat: add API to fetch impersonation requests
* added unit tests for fetch logic

* fixed types and small comments

* fixed comments and variable types

* added impersonation requests array

* removed update model function from tests

* removed page based pagination from tests

* added new validator tests for new route

---------

Co-authored-by: Achintya Chatterjee <55826451+Achintya-Chatterjee@users.noreply.github.com>
* added integration tests for get requests functionality

* fixed test descriptions

* fixed comments on tests and test descriptions

* removed page based pagination tests

* fixed tests according to new route

* fixed test descriptions

* fixed failing test

---------

Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
* added services, controllers and model for update impersonation requests

* added route and fixed jsdoc

* fixed bot comments and typos

* removed validation service and fixed forbidden errors

* removed validation service
* added unit tests for update impersonation requests

* fixed tests and errors

* removed validation service tests

* fixed comments and tests

* fixeed naming and stubbing issue in tests

* added test for missing message field in validators

* fixed spacing and test stub

* fixed merge conflict
* added integration tests for update impersonation requests

* fixed errors due to bad pull

* added error handling

* fixed integration tests imports and resolved comments

* fixed bot comments

---------

Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
let mockRequestBody = impersonationRequestsBodyData[0];
let testUserId:string;
let impersonationRequests=[];
const userData = userDataFixture();
Copy link

Choose a reason for hiding this comment

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

This line creates a duplicate declaration of userData which shadows the previous declaration at line 13. This can lead to confusion and potential bugs. Consider removing this redundant declaration to maintain a single source of truth for the variable.

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

* added functionality for start and stop of impersonation

* added middleware and fixed code quality

* fixed bot comments

* removed unused types and fixed authentication middleware jsdoc

* fixed bot comments

* fixed controller import

* fixed build errors

* fixed failing test

* used constants for 403 error

* fixed jsdoc for middleware
* added unit tests for impersonation session route

* fixed test identation and spacing

* fixed unecessary imports and variable in tests

* fixed comments on tests

* fixed naming mistake in test

* fixed failing test
* added integration tests for impersonation session feature

* fixed linting and tests

* fixed missing variable and identation

* fixed tests

* fixed request names

* fixed spacing in tests

---------

Co-authored-by: Yash Raj <yashraj0207@outlook.com>
)

* fix/removed createdBy and createdFor for filtering and  impersonation collection

* renamed userId and impersonatedUserId

* removed unecessary imports
@Suvidh-kaushik
Copy link
Contributor

Staging Proof for impersonation feature

impersonation_feature_recording_postman.mp4

@iamitprakash iamitprakash merged commit 36a094c into main Jul 19, 2025
8 of 9 checks passed
@railway-app railway-app bot temporarily deployed to marvelous-patience / production February 3, 2026 06:49 Inactive
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.

6 participants