Skip to content

feat: add duplicate functionality for managed event types#26792

Merged
alishaz-polymath merged 15 commits intomainfrom
devin/duplicate-managed-event-types-1768299152
Feb 18, 2026
Merged

feat: add duplicate functionality for managed event types#26792
alishaz-polymath merged 15 commits intomainfrom
devin/duplicate-managed-event-types-1768299152

Conversation

@PeerRich
Copy link
Copy Markdown
Member

@PeerRich PeerRich commented Jan 13, 2026

What does this PR do?

Enables the "Duplicate" option in the dropdown menu for managed event types. Previously, managed event types could not be duplicated, requiring users to manually recreate all settings when creating a new managed event type.

Changes

Removed the !isManagedEventType condition from the duplicate button visibility check in both desktop and mobile views of the event types listing page. The existing duplicate handler already supports managed event types correctly:

  • Preserves schedulingType: MANAGED
  • Does not copy child event types (children are created separately when members are assigned)
  • Parent managed event types have parentId: null, which is preserved correctly

Note: Children managed event types (event types created from a managed parent) still cannot be duplicated, as the !isChildrenManagedEventType check remains in place.

UX Improvements for Managed Event Type Duplication

  • Disclaimer message: Shows an info alert in the duplicate modal for managed event types explaining that user assignments are not copied and must be added manually after duplication
  • Redirect to assignment tab: After duplicating a managed event type, the user is redirected to the assignment tab (?tabName=team) so they can immediately add team members
  • Added translation key managed_event_type_duplicate_disclaimer for the disclaimer message

Handler Bug Fix

  • Fixed the duplicate.handler.ts catch block to re-throw TRPCError instances (e.g. FORBIDDEN, NOT_FOUND) instead of swallowing them and re-wrapping as INTERNAL_SERVER_ERROR

Test Migration

  • Replaced the PrismaMock-based unit test (duplicate.handler.test.ts) with a real Prisma integration test (duplicate.handler.integration-test.ts)
  • Zero as any casts — uses proper typing throughout
  • 7 test scenarios covering: individual duplication, managed type preservation, host copying, parentId nulling, team member access, non-member rejection (FORBIDDEN), and slug conflict (CONFLICT)

Visual Demo

Duplicate option visible on managed event type:

Duplicate option in dropdown menu for managed event type

Duplicate modal with disclaimer for managed event types:

Duplicate modal showing disclaimer message

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no documentation changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Log in as a team admin/owner
  2. Navigate to Event Types page
  3. Create or find an existing managed event type (scheduling type = MANAGED)
  4. Click the three-dot menu on the managed event type
  5. Verify the "Duplicate" option is now visible
  6. Click "Duplicate" and verify the duplicate dialog opens
  7. Verify the info disclaimer message appears explaining that user assignments are not copied
  8. Complete the duplication and verify:
    • A new managed event type is created with the same settings
    • You are redirected to the assignment/team tab after duplication

Also verify:

  • Children managed event types (created from a managed parent) should NOT show the duplicate option
  • Regular event types and collective/round-robin event types should still show the duplicate option as before
  • The disclaimer message should NOT appear when duplicating non-managed event types

Checklist

  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings

Human Review Checklist

  • Verify the duplicate handler (packages/trpc/server/routers/viewer/eventTypes/heavy/duplicate.handler.ts) properly handles managed event types
  • Test that duplicating a managed event type creates a new parent managed event type (not a child)
  • Confirm children managed event types still cannot be duplicated
  • Verify the disclaimer Alert only appears for managed event types in the duplicate modal
  • Verify redirect to ?tabName=team works correctly after duplicating a managed event type
  • Check that the translation key displays correctly (not just the key name)
  • Review the integration tests in duplicate.handler.integration-test.ts for completeness
  • IMPORTANT: Check the indentation in event-types-listing-view.tsx lines 432-446 — there appears to be extra indentation that may cause lint issues
  • Verify the handler's error re-throwing logic (lines 228-230) doesn't mask legitimate errors
  • Confirm schedulingType query param is properly validated via zod schema

Link to Devin run: https://app.devin.ai/sessions/d6a4ad26a26140a2b7d70a5519e2636e
Requested by: @alishaz-polymath

Co-Authored-By: peer@cal.com <peer@cal.com>
@linear
Copy link
Copy Markdown

linear bot commented Jan 13, 2026

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions github-actions bot added Low priority Created by Linear-GitHub Sync teams area: teams, round robin, collective, managed event-types ✨ feature New feature or request 🚧 wip / in the making This is currently being worked on labels Jan 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions bot added the Stale label Jan 21, 2026
@keithwillcode keithwillcode added the core area: core, team members only label Feb 3, 2026
@PeerRich PeerRich marked this pull request as ready for review February 5, 2026 12:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 5, 2026

Devin AI is resolving merge conflicts

This PR has merge conflicts with the main branch. A Devin session has been created to automatically resolve them.

View Devin Session

Devin will:

  1. Merge the latest main into this branch
  2. Resolve any conflicts intelligently
  3. Run lint/type checks to ensure validity
  4. Push the resolved changes

If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself.

Copy link
Copy Markdown
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

PeerRich and others added 3 commits February 6, 2026 09:27
- Add info alert disclaimer in duplicate modal for managed event types
- Pass schedulingType to duplicate dialog via query params
- Redirect to assignment tab after duplicating managed event types
- Add translation key for managed event type duplicate disclaimer

Co-Authored-By: peer@cal.com <peer@cal.com>
@pull-request-size pull-request-size bot added size/M and removed size/S labels Feb 6, 2026
@alishaz-polymath alishaz-polymath added run-ci Approve CI to run for external contributors and removed ready-for-e2e labels Feb 9, 2026
@alishaz-polymath alishaz-polymath added size/M and removed size/L run-ci Approve CI to run for external contributors labels Feb 10, 2026
@alishaz-polymath alishaz-polymath added run-ci Approve CI to run for external contributors and removed size/L 🚧 wip / in the making This is currently being worked on labels Feb 10, 2026
@pull-request-size pull-request-size bot added size/L and removed size/M labels Feb 12, 2026
@github-actions github-actions bot added the 🚧 wip / in the making This is currently being worked on label Feb 12, 2026
alishaz-polymath and others added 2 commits February 16, 2026 12:37
…or duplicate handler (#27973)

* refactor: replace PrismaMock unit test with Prisma integration test for duplicate handler

Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>

* fix: re-throw TRPCErrors in duplicate handler catch block and assert specific error codes in tests

Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@alishaz-polymath alishaz-polymath added run-ci Approve CI to run for external contributors and removed run-ci Approve CI to run for external contributors labels Feb 16, 2026
@alishaz-polymath alishaz-polymath enabled auto-merge (squash) February 16, 2026 11:27
Copy link
Copy Markdown
Member

@alishaz-polymath alishaz-polymath left a comment

Choose a reason for hiding this comment

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

LGTM

@alishaz-polymath alishaz-polymath merged commit eef47dd into main Feb 18, 2026
47 checks passed
@alishaz-polymath alishaz-polymath deleted the devin/duplicate-managed-event-types-1768299152 branch February 18, 2026 12:49
pedroccastro pushed a commit that referenced this pull request Feb 21, 2026
* feat: add duplicate functionality for managed event types

Co-Authored-By: peer@cal.com <peer@cal.com>

* feat: add disclaimer and redirect for managed event type duplication

- Add info alert disclaimer in duplicate modal for managed event types
- Pass schedulingType to duplicate dialog via query params
- Redirect to assignment tab after duplicating managed event types
- Add translation key for managed event type duplicate disclaimer

Co-Authored-By: peer@cal.com <peer@cal.com>

* test: add tests for managed event type duplication

Co-Authored-By: peer@cal.com <peer@cal.com>

* refactor: replace PrismaMock unit test with Prisma integration test for duplicate handler (#27973)

* refactor: replace PrismaMock unit test with Prisma integration test for duplicate handler

Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>

* fix: re-throw TRPCErrors in duplicate handler catch block and assert specific error codes in tests

Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Hariom Balhara <1780212+hariombalhara@users.noreply.github.com>
Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only ✨ feature New feature or request Low priority Created by Linear-GitHub Sync ready-for-e2e run-ci Approve CI to run for external contributors size/L teams area: teams, round robin, collective, managed event-types 🚧 wip / in the making This is currently being worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate Managed Event Types

5 participants