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

feat: Allow hideBranding via public API #11978

Merged
merged 3 commits into from
Oct 19, 2023
Merged

Conversation

alishaz-polymath
Copy link
Member

@alishaz-polymath alishaz-polymath commented Oct 18, 2023

What does this PR do?

Allows toggling hideBranding on or off for a user via public API calls (made by instance Admins, of course).

Requirement/Documentation

  • If there is a requirement document, please, share it here.
  • If there is ab UI/UX design document, please, share it here.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • You should be able to update hideBranding in /users endpoint via POST or /users/[id] PATCH requests made by Admin.
  • You shouldn't be able to update hideBranding in /users/[id] PATCH request by a non-Admin user

Mandatory Tasks

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

Checklist

@vercel
Copy link

vercel bot commented Oct 18, 2023

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

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 4:25am
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 4:25am
cal-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 4:25am
dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 4:25am
qa 🔄 Building (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 4:25am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Oct 19, 2023 4:25am
ui ⬜️ Ignored (Inspect) Visit Preview Oct 19, 2023 4:25am

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2023

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2023

📦 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! 🙌

@deploysentinel
Copy link

deploysentinel bot commented Oct 18, 2023

Current Playwright Test Results Summary

✅ 162 Passing - ⚠️ 4 Flaky

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

(Last updated on 10/19/2023 04:27:31am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: e71ffce

Started: 10/19/2023 04:24:45am UTC

⚠️ Flakes

📄   apps/web/playwright/login.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
user can login & logout succesfully login flow user & logout using dashboard
Retry 1Initial Attempt
0% (0) 0 / 269 runs
failed over last 7 days
1.12% (3) 3 / 269 runs
flaked over last 7 days

📄   apps/web/playwright/profile.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Teams Profile page is loaded for users in Organization
Retry 1Initial Attempt
0.74% (2) 2 / 270 runs
failed over last 7 days
29.26% (79) 79 / 270 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.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
Popup Tests should be able to reschedule
Retry 2Retry 1Initial Attempt
8.19% (23) 23 / 281 runs
failed over last 7 days
90.04% (253) 253 / 281 runs
flaked over last 7 days
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
3.55% (10) 10 / 282 runs
failed over last 7 days
35.82% (101) 101 / 282 runs
flaked over last 7 days

View Detailed Build Results


// disable role or branding changes unless admin.
if (!isAdmin) {
if (body.role) body.role = undefined;
if (body.hideBranding) body.hideBranding = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I incorrect in thinking this is going to actually override the hideBranding value that's already stored in the database instead of just ignoring what's on the body since we just use the full body object on line 199?

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 would ignore "hideBranding" as the only acceptable values for hideBranding are boolean, and undefined is pretty much as if it hasn't been passed (since this is optional) in validation schema.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool

@keithwillcode keithwillcode self-requested a review October 19, 2023 13:30
Copy link
Contributor

@keithwillcode keithwillcode left a comment

Choose a reason for hiding this comment

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

Looks good. Let's make sure to follow up with a PR with automated tests verifying this functionality.

@keithwillcode keithwillcode merged commit 4b818de into main Oct 19, 2023
@keithwillcode keithwillcode deleted the feat/hide-branding-via-api branch October 19, 2023 13:31
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 ✨ feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants