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

Create data model and transformers for Organization type #9152

Merged
merged 10 commits into from
Sep 13, 2024

Conversation

grahamlangford
Copy link
Collaborator

What does this PR do?

Discussion

  • Needed to reuse the organization transformer in the service worker
  • Realized the transformer belonged in the data layer
  • Tried to follow the existing pattern to fully implement the transformer

For more information on our expectations for the PR process, see the
code review principles doc

@@ -46,7 +46,7 @@ export type SharingType =
export type SharingSource = {
type: SharingType;
label: string;
organization?: Nullishable<Organization>;
organization?: Nullishable<AuthUserOrganization>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was just the wrong type. Fixing the types revealed that

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 60.24096% with 33 lines in your changes missing coverage. Please review.

Project coverage is 74.84%. Comparing base (8318d74) to head (5c9c4e2).
Report is 290 commits behind head on main.

Files with missing lines Patch % Lines
src/data/model/UserRole.ts 34.78% 15 Missing ⚠️
...ensionConsole/pages/packageEditor/SharingTable.tsx 0.00% 9 Missing ⚠️
...pages/packageEditor/referenceTab/PackageResult.tsx 0.00% 3 Missing ⚠️
...ields/schemaFields/widgets/DatabaseCreateModal.tsx 33.33% 2 Missing ⚠️
src/data/model/Organization.ts 86.66% 2 Missing ⚠️
src/hooks/useDatabaseOptions.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9152      +/-   ##
==========================================
+ Coverage   74.24%   74.84%   +0.59%     
==========================================
  Files        1332     1355      +23     
  Lines       40817    41809     +992     
  Branches     7634     7802     +168     
==========================================
+ Hits        30306    31291     +985     
- Misses      10511    10518       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Sep 13, 2024

Playwright test results

passed  124 passed
flaky  4 flaky
skipped  4 skipped

Details

report  Open report ↗︎
stats  132 tests across 44 suites
duration  12 minutes, 38 seconds
commit  5c9c4e2
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
msedge › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
msedge › tests/regressions/welcomeStarterBricks.spec.ts › #8740: can view the starter mods on the pixiebrix.com/welcome page
chrome › tests/runtime/sidebar/sidebarController.spec.ts › sidebar controller › can open sidebar immediately from iframe without focus dialog

Skipped tests

chrome › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
msedge › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

Comment on lines 74 to 83
.filter(
(organization) =>
organization.members?.some(
(member) =>
// If the current user is an admin of the organization, then all of the members are listed for the organization
// Otherwise, only the current user is listed for the organization
// So if any listed member is an admin, the current user is an admin
member.role === UserRole.admin,
),
)
Copy link
Collaborator Author

@grahamlangford grahamlangford Sep 13, 2024

Choose a reason for hiding this comment

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

Comment on lines -51 to -57
export type Organization = components["schemas"]["Organization"] & {
// The `role` property is added in the Redux RTK definition for getOrganizations (see api.ts)
// WARNING: currently this role is only accurate for Admin. All other users are passed as Restricted even if they have
// a Member or Developer role on the team
role: UserRole;
};

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@mnholtz mnholtz left a comment

Choose a reason for hiding this comment

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

Ready to approve once changes are made to OrganizationMember -> OrganizationMembership prefix

Copy link

No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack.

Do not edit this comment manually.

@grahamlangford grahamlangford enabled auto-merge (squash) September 13, 2024 20:04
@grahamlangford grahamlangford merged commit 21e6b4e into main Sep 13, 2024
20 checks passed
@grahamlangford grahamlangford deleted the create-organization-data-model branch September 13, 2024 20:21
@grahamlangford grahamlangford added this to the 2.1.2 milestone Sep 17, 2024
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