Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: og images avatars #13790

Merged
merged 5 commits into from
Feb 20, 2024
Merged

fix: og images avatars #13790

merged 5 commits into from
Feb 20, 2024

Conversation

zomars
Copy link
Member

@zomars zomars commented Feb 20, 2024

What does this PR do?

Fixes some edge cases for OG avatars not displaying properly

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  • Verify generated images are displaying properly in public pages

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

@zomars zomars requested a review from a team February 20, 2024 21:06
Copy link
Contributor

github-actions bot commented Feb 20, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@keithwillcode keithwillcode added api area: API, enterprise API, access token, OAuth core area: core, team members only foundation labels Feb 20, 2024
@graphite-app graphite-app bot requested a review from a team February 20, 2024 21:07
Copy link

vercel bot commented Feb 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 10:26pm
cal ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 10:26pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 10:26pm
qa ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 10:26pm

Copy link
Member Author

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Self review done

Comment on lines +210 to +213
image: getUserAvatarUrl({
...user,
profile: user.profile,
}),
Copy link
Member Author

Choose a reason for hiding this comment

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

This was returning "image": "/peer/avatar.png" which is wrong.

image

Comment on lines +37 to +39
export const CAL_URL = new URL(WEBAPP_URL).hostname.endsWith(".vercel.app")
? WEBAPP_URL
: process.env.NEXT_PUBLIC_WEBSITE_URL || WEBAPP_URL;
Copy link
Member Author

Choose a reason for hiding this comment

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

Avoid hard-coding cal.com as much as possible. In our hosted instance NEXT_PUBLIC_WEBSITE_URL is always set as https://cal.com so there should not be any problems here. Also this won't disturb self-hosts.

import type { UserProfile } from "@calcom/types/UserProfile";

/**
* Gives an organization aware avatar url for a user
* It ensures that the wrong avatar isn't fetched by ensuring that organizationId is always passed
* It should always return a fully formed url
*/
export const getUserAvatarUrl = (
Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored so we always return fully formed URLs

@@ -62,7 +62,7 @@ export const constructMeetingImage = (
`?type=meeting`,
`&title=${encodeURIComponent(title)}`,
`&meetingProfileName=${encodeURIComponent(profile.name)}`,
profile.image && `&meetingImage=${encodeURIComponent(WEBAPP_URL + profile.image)}`,
Copy link
Member Author

Choose a reason for hiding this comment

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

image should return fully formed always.

@@ -125,7 +125,7 @@ export const Meeting = ({ title, users = [], profile }: MeetingImageProps) => {
const avatars = attendees
.map((user) => {
if ("image" in user && user?.image) return user.image;
if ("username" in user && user?.username) return `${WEBAPP_URL}/${user.username}/avatar.png`;
if ("username" in user && user?.username) return `${CAL_URL}/${user.username}/avatar.png`;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a last resort fallback.

@zomars zomars changed the title fix og images avatars fix: og images avatars Feb 20, 2024
PeerRich
PeerRich previously approved these changes Feb 20, 2024
Copy link
Contributor

github-actions bot commented Feb 20, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

graphite-app bot commented Feb 20, 2024

Graphite Automations

A Graphite automation took an action on this PR • (02/20/24)

1 reviewer was added based on Keith Williams's automation, 'Add foundation team as reviewer'

Copy link

deploysentinel bot commented Feb 20, 2024

Current Playwright Test Results Summary

✅ 435 Passing - ⚠️ 23 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 02/20/2024 10:47:28pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 38a08f9

Started: 02/20/2024 10:36:53pm UTC

⚠️ Flakes

📄   apps/web/playwright/booking/multipleEmailQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Multiple Email Question and Each Other Question Booking With Multiple Email Question and Radio group Question Booking With Multiple Email Question and Short text question Multiple Email and Short text not required
Retry 1Initial Attempt
0% (0) 0 / 242 runs
failed over last 7 days
4.13% (10) 10 / 242 runs
flaked over last 7 days

📄   apps/web/playwright/locale.e2e.ts • 13 Flakes

Top 1 Common Error Messages

null

13 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
unauthorized user sees correct translations (de) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
unauthorized user sees correct translations (ar) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
unauthorized user sees correct translations (zh) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
unauthorized user sees correct translations (zh-CN) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
unauthorized user sees correct translations (zh-TW) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
unauthorized user sees correct translations (pt) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
unauthorized user sees correct translations (pt-br) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
unauthorized user sees correct translations (es-419) should use correct translations and html attributes
Retry 1Initial Attempt
-7.45% (-19) -19 / 255 runs
failed over last 7 days
7.45% (19) 19 / 255 runs
flaked over last 7 days
authorized user sees correct translations (de) should return correct translations and html attributes
Retry 1Initial Attempt
-7.48% (-19) -19 / 254 runs
failed over last 7 days
7.48% (19) 19 / 254 runs
flaked over last 7 days
authorized user sees correct translations (pt-br) should return correct translations and html attributes
Retry 1Initial Attempt
-7.48% (-19) -19 / 254 runs
failed over last 7 days
7.48% (19) 19 / 254 runs
flaked over last 7 days
authorized user sees correct translations (ar) should return correct translations and html attributes
Retry 1Initial Attempt
-7.48% (-19) -19 / 254 runs
failed over last 7 days
7.48% (19) 19 / 254 runs
flaked over last 7 days
authorized user sees changed translations (de->ar) should return correct translations and html attributes
Retry 1Initial Attempt
-2.36% (-6) -6 / 254 runs
failed over last 7 days
5.51% (14) 14 / 254 runs
flaked over last 7 days
authorized user sees changed translations (de->pt-BR) [locale1] should return correct translations and html attributes
Retry 1Initial Attempt
-2.04% (-5) -5 / 245 runs
failed over last 7 days
5.31% (13) 13 / 245 runs
flaked over last 7 days

📄   apps/web/playwright/booking/radioGroupQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Radio Question and Each Other Question Booking With Radio Question and Address Question Booking With Radio Question and select Question Radio and select not required
Retry 2Retry 1Initial Attempt
0.38% (1) 1 / 261 run
failed over last 7 days
4.60% (12) 12 / 261 runs
flaked over last 7 days

📄   apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Address Question and Each Other Question Booking With Address Question and Checkbox Question Addres and checkbox not required
Retry 1Initial Attempt
1.54% (4) 4 / 259 runs
failed over last 7 days
5.02% (13) 13 / 259 runs
flaked over last 7 days
Booking With Address Question and Each Other Question Booking With Address Question and Radio group Question Address required and Radio group required
Retry 1Initial Attempt
0% (0) 0 / 252 runs
failed over last 7 days
5.16% (13) 13 / 252 runs
flaked over last 7 days

📄   apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Stripe integration Pending payment booking should not be confirmed by default
Retry 1Initial Attempt
1.54% (4) 4 / 260 runs
failed over last 7 days
20.77% (54) 54 / 260 runs
flaked over last 7 days

📄   apps/web/playwright/booking/phoneQuestion.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Phone Question and Each Other Question Booking With Phone Question and Address Question Booking With Phone Question and checkbox Question Phone and checkbox required
Retry 1Initial Attempt
1.49% (4) 4 / 268 runs
failed over last 7 days
6.72% (18) 18 / 268 runs
flaked over last 7 days
Booking With Phone Question and Each Other Question Booking With Phone Question and Address Question Booking With Phone Question and checkbox Question Phone required and checkbox not required
Retry 1Initial Attempt
0.38% (1) 1 / 265 run
failed over last 7 days
4.91% (13) 13 / 265 runs
flaked over last 7 days

📄   apps/web/playwright/profile.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Update Profile Cannot update a users email when existing user has same email (verification enabled)
Retry 1Initial Attempt
1.47% (4) 4 / 272 runs
failed over last 7 days
50.74% (138) 138 / 272 runs
flaked over last 7 days
Update Profile Can update a users email (verification enabled)
Retry 1Initial Attempt
13.55% (37) 37 / 273 runs
failed over last 7 days
50.92% (139) 139 / 273 runs
flaked over last 7 days

📄   apps/web/playwright/event-types.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests -- future user Different Locations Tests Can add Organzer Phone Number location and book with it
Retry 1Initial Attempt
0% (0) 0 / 261 runs
failed over last 7 days
2.30% (6) 6 / 261 runs
flaked over last 7 days

View Detailed Build Results


keithwillcode
keithwillcode previously approved these changes Feb 20, 2024
@keithwillcode
Copy link
Contributor

Code looks good. Need to test

Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

More inconsistencies! nice spot 😮‍💨

@emrysal emrysal enabled auto-merge (squash) February 20, 2024 23:04
@emrysal emrysal merged commit 73b5839 into main Feb 20, 2024
38 checks passed
@emrysal emrysal deleted the fix/og-image-avatars branch February 20, 2024 23:05
@zomars zomars mentioned this pull request Feb 22, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api area: API, enterprise API, access token, OAuth core area: core, team members only foundation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants