Skip to content

Team webhooks#8917

Merged
zomars merged 40 commits into
mainfrom
feat/team-webhooks
May 23, 2023
Merged

Team webhooks#8917
zomars merged 40 commits into
mainfrom
feat/team-webhooks

Conversation

@CarinaWolli

@CarinaWolli CarinaWolli commented May 16, 2023

Copy link
Copy Markdown
Member

What does this PR do?

  • Adds webhooks for teams. Only admins and owners can create, edit and delete webhooks:

Admin/Owner:
Screenshot 2023-05-16 at 14 19 47

Member:
Screenshot 2023-05-16 at 14 20 06

  • Also adds event type webhooks for user event types. Until now only team event types could have even type webhooks

Fixes #8815

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  • Create team, event type and user webhooks
  • Test editing and deleting webhooks
  • Test with users that have different membership roles
  • Test if webhooks trigger as expected

@vercel

vercel Bot commented May 16, 2023

Copy link
Copy Markdown

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

Name Status Preview Comments Updated (UTC)
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2023 8:58pm
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2023 8:58pm

@github-actions

github-actions Bot commented May 16, 2023

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for @calcom/web

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

Two Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/auth/setup 174.06 KB 324.97 KB 92.85% (🟢 -0.16%)
/settings/developer/webhooks 246.23 KB 397.15 KB 113.47% (🟡 +0.17%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@deploysentinel

deploysentinel Bot commented May 16, 2023

Copy link
Copy Markdown

Current Playwright Test Results Summary

✅ 114 Passing - ⚠️ 2 Flaky

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

(Last updated on 05/22/2023 09:11:35pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 2fcc335

Started: 05/22/2023 09:02:22pm UTC

⚠️ Flakes

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

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking with Seats -- new-booker Reschedule for booking with seats -- old-booker Should reschedule booking with seats and if everyone rescheduled it should be deleted
Retry 1Initial Attempt
0% (0) 0 / 302 runs
failed over last 7 days
85.10% (257) 257 / 302 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.test.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should be able to reschedule
Retry 2Retry 1Initial Attempt
9.09% (16) 16 / 176 runs
failed over last 7 days
30.68% (54) 54 / 176 runs
flaked over last 7 days

View Detailed Build Results


@hariombalhara

hariombalhara commented May 22, 2023

Copy link
Copy Markdown
Member

Editing an EventType webhook throws error even if I don't change the webhook URL
image

@hariombalhara hariombalhara left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left some comments. Only one is an actual bug(EventType Webhook Edit) others are just nits.
Also, the authorization logic is quite tricky right now(with duplication). I would review that tomorrow and then approve.

Comment on lines +126 to +137
const userBelongsToTeam =
eventType.team &&
eventType.team.members.some(
(membership) =>
membership.userId === ctx.user.id &&
(membership.role === MembershipRole.ADMIN || membership.role === MembershipRole.OWNER)
);
if (!userBelongsToTeam) {
throw new TRPCError({
code: "UNAUTHORIZED",
});
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can remove duplication like this
assertPartOfTeamWithRequiredAccessLevel()

@CarinaWolli

Copy link
Copy Markdown
Member Author

@alannnc and @hariombalhara Thank you for the feedback 🙏 I addressed most of it already (@hariombalhara I still need to take a look at that error when editing). I will also do one more round of testing to make sure the clean-up didn't break anything

@alannnc alannnc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Let's wait for those test and it should be good to go.

@zomars zomars left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ship it

Nice work! @CarinaWolli @alannnc @hariombalhara 🙏🏽

@zomars zomars added this pull request to the merge queue May 23, 2023
Merged via the queue into main with commit 84efda0 May 23, 2023
@zomars zomars deleted the feat/team-webhooks branch May 23, 2023 01:40
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ autoupdate tells kodiak to keep this branch up-to-date core area: core, team members only ❗️ migrations contains migration files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-1648] Webhooks tab is empty

5 participants