Skip to content

fix(companion): event type links for org user#5

Open
tomerqodo wants to merge 7 commits intogreptile_full_base_fixcompanion_event_type_links_for_org_user_pr5from
greptile_full_head_fixcompanion_event_type_links_for_org_user_pr5
Open

fix(companion): event type links for org user#5
tomerqodo wants to merge 7 commits intogreptile_full_base_fixcompanion_event_type_links_for_org_user_pr5from
greptile_full_head_fixcompanion_event_type_links_for_org_user_pr5

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#5

dhairyashiil and others added 7 commits January 25, 2026 12:01
Addresses Cubic AI review feedback (confidence 9/10): The username was
hardcoded to 'username' but still used by BasicsTab as a fallback for
URL display when bookingUrl is unavailable. This restores the useEffect
that fetches the actual username from CalComAPIService.getUsername().

Co-Authored-By: unknown <>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

This PR updates event type link handling for organization users by adding a bookingUrl field from the API instead of constructing URLs client-side from username and slug.

Key changes:

  • Added bookingUrl optional field to EventType interface for API V2
  • Removed buildEventTypeLink function from CalComAPIService - URLs now provided directly by the API
  • Updated all event type link displays and actions (preview, copy, share) to use bookingUrl with fallback to constructed URLs
  • Added URL parsing logic to display correct domain/path for org users (e.g., i.cal.com/keith/30min)
  • Updated UI colors from iOS blue to black across multiple components
  • Added inline flexbox styles for layout consistency

Issues found:

  • Critical: bookingUrl state variable is created but never populated from event type data in event-type-detail.tsx
  • One copy button handler in content.ts doesn't use the bookingUrl field (inconsistent with second instance)

Confidence Score: 2/5

  • Critical bug prevents the event type detail page from working correctly
  • The PR has a critical logic error in event-type-detail.tsx where bookingUrl state is never populated from the event data, causing preview and copy link functions to always fail with "Booking URL not available" errors. Additionally, one copy button in the extension code is inconsistent with the pattern used elsewhere.
  • Pay close attention to companion/app/(tabs)/(event-types)/event-type-detail.tsx and companion/extension/entrypoints/content.ts - both have critical bugs that will break functionality

Important Files Changed

Filename Overview
companion/services/calcom.ts Removed buildEventTypeLink function and moved getUsername with error handling; API now provides bookingUrl directly
companion/components/event-type-list-item/EventTypeListItemParts.tsx Added getDisplayUrl helper to parse and display bookingUrl with fallback to username/slug format
companion/app/(tabs)/(event-types)/event-type-detail.tsx Added bookingUrl state but never populates it from event data; preview and copy link functions now check for empty bookingUrl
companion/components/event-type-detail/tabs/BasicsTab.tsx Updated URL prefix display to parse bookingUrl and show correct domain/path for org users
companion/extension/entrypoints/content.ts Added bookingUrl to event type interfaces and updated URL construction to prefer bookingUrl with fallback

Sequence Diagram

sequenceDiagram
    participant User
    participant App as Companion App
    participant API as Cal.com API
    participant Extension as Browser Extension

    Note over User,Extension: Event Type URL Flow for Org Users

    User->>API: Fetch event types
    API-->>App: Return event types with bookingUrl field
    Note over API,App: bookingUrl includes full URL<br/>(e.g., https://i.cal.com/keith/30min)
    
    App->>App: Parse bookingUrl to extract domain/path
    App->>User: Display correct URL prefix in UI
    
    alt User previews event type
        User->>App: Click preview button
        App->>App: Check if bookingUrl exists
        alt bookingUrl available
            App->>App: Open bookingUrl in browser
        else bookingUrl not available
            App->>User: Show error: "Booking URL not available"
        end
    end
    
    alt User copies event link
        User->>App: Click copy link
        App->>App: Check if bookingUrl exists
        alt bookingUrl available
            App->>App: Copy bookingUrl to clipboard
            App->>User: Show success message
        else bookingUrl not available
            App->>User: Show error: "Booking URL not available"
        end
    end
    
    alt Extension integration
        User->>Extension: Open LinkedIn integration
        Extension->>API: Fetch event types
        API-->>Extension: Return event types with bookingUrl
        Extension->>Extension: buildBookingUrl(eventType)
        Note over Extension: Prefers bookingUrl,<br/>falls back to username/slug
        Extension->>User: Insert booking URL into message
    end
Loading

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +1125 to +1128
const bookingUrl =
`https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

First copy button handler doesn't use eventType.bookingUrl with fallback like the second instance does at line 1869-1871

Suggested change
const bookingUrl =
`https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
const bookingUrl =
eventType.bookingUrl ||
`https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
Prompt To Fix With AI
This is a comment left during a code review.
Path: companion/extension/entrypoints/content.ts
Line: 1125:1128

Comment:
First copy button handler doesn't use `eventType.bookingUrl` with fallback like the second instance does at line 1869-1871

```suggestion
                    const bookingUrl =
                      eventType.bookingUrl ||
                      `https://cal.com/${
                        eventType.users?.[0]?.username || "user"
                      }/${eventType.slug}`;
```

How can I resolve this? If you propose a fix, please make it concise.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jan 26, 2026

Additional Comments (1)

companion/app/(tabs)/(event-types)/event-type-detail.tsx
bookingUrl state is never populated from eventType.bookingUrl in the applyEventTypeData function. The preview and copy link functions will always show "Booking URL not available" error.

  const applyEventTypeData = useCallback((eventType: EventType) => {
    setEventTypeData(eventType);

    // Load basic fields
    if (eventType.title) setEventTitle(eventType.title);
    if (eventType.slug) setEventSlug(eventType.slug);
    if (eventType.description) setEventDescription(eventType.description);
    if (eventType.lengthInMinutes) setEventDuration(eventType.lengthInMinutes.toString());
    if (eventType.hidden !== undefined) setIsHidden(eventType.hidden);
    if (eventType.bookingUrl) setBookingUrl(eventType.bookingUrl);
Prompt To Fix With AI
This is a comment left during a code review.
Path: companion/app/(tabs)/(event-types)/event-type-detail.tsx
Line: 451:460

Comment:
`bookingUrl` state is never populated from `eventType.bookingUrl` in the `applyEventTypeData` function. The preview and copy link functions will always show "Booking URL not available" error.

```suggestion
  const applyEventTypeData = useCallback((eventType: EventType) => {
    setEventTypeData(eventType);

    // Load basic fields
    if (eventType.title) setEventTitle(eventType.title);
    if (eventType.slug) setEventSlug(eventType.slug);
    if (eventType.description) setEventDescription(eventType.description);
    if (eventType.lengthInMinutes) setEventDuration(eventType.lengthInMinutes.toString());
    if (eventType.hidden !== undefined) setIsHidden(eventType.hidden);
    if (eventType.bookingUrl) setBookingUrl(eventType.bookingUrl);
```

How can I resolve this? If you propose a fix, please make it concise.

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