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
Conversation
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 OverviewGreptile SummaryThis PR updates event type link handling for organization users by adding a Key changes:
Issues found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
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
|
Comment on lines
+1125
to
+1128
| const bookingUrl = | ||
| `https://cal.com/${ | ||
| eventType.users?.[0]?.username || "user" | ||
| }/${eventType.slug}`; |
There was a problem hiding this comment.
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.
Additional Comments (1)
Prompt To Fix With AIThis 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmark PR from agentic-review-benchmarks#5