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(sales-dashboard): prevent 500 error when user doesn't exist on sales dashboard search #4757

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

matthewelwell
Copy link
Contributor

@matthewelwell matthewelwell commented Oct 22, 2024

Changes

Prevents a 500 error when searching the sales dashboard for a user email address that doesn't exist.

Also adds functionality to search by a domain, which will now search across all users with that domain and return any organisations that belong to users with that domain.

Note that the reason this can't be simplified to e.g. users__email__endswith is because of this PR: #4377.

How did you test this code?

Added a new unit test.

@matthewelwell matthewelwell requested a review from a team as a code owner October 22, 2024 16:52
@matthewelwell matthewelwell requested review from gagantrivedi and removed request for a team October 22, 2024 16:52
Copy link

vercel bot commented Oct 22, 2024

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 1:01pm
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 1:01pm
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 1:01pm

@github-actions github-actions bot added api Issue related to the REST API fix labels Oct 22, 2024
Copy link
Contributor

github-actions bot commented Oct 22, 2024

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-frontend:pr-4757 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-e2e:pr-4757 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-4757 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-4757 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-4757 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4757 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4757 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4757 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4757 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Oct 22, 2024

Uffizzi Ephemeral Environment Deploying

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/4757

⚙️ Updating now by workflow run 11518746962.

What is Uffizzi? Learn more!

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.22%. Comparing base (6d2ab58) to head (b7d395f).
Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4757   +/-   ##
=======================================
  Coverage   97.21%   97.22%           
=======================================
  Files        1172     1172           
  Lines       40535    40560   +25     
=======================================
+ Hits        39408    39434   +26     
+ Misses       1127     1126    -1     

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

@rolodato
Copy link
Member

grabs the domain and searches for organisations belonging to users with that domain.

This behaviour is super useful, but I don't like it as a fallback, especially for public domains such as gmail.com, icloud.com, etc. Returning 0 results when searching for a specific user in this case is desirable.

Instead, we could make this explicit when searching for a domain, like @example.com, which would return all organisations that have users with a domain of example.com.

@matthewelwell
Copy link
Contributor Author

grabs the domain and searches for organisations belonging to users with that domain.

This behaviour is super useful, but I don't like it as a fallback, especially for public domains such as gmail.com, icloud.com, etc. Returning 0 results when searching for a specific user in this case is desirable.

Instead, we could make this explicit when searching for a domain, like @example.com, which would return all organisations that have users with a domain of example.com.

Yeah, I tend to agree. I was just being lazy. I'll update.

@github-actions github-actions bot added fix and removed fix labels Oct 25, 2024
@github-actions github-actions bot added fix and removed fix labels Oct 25, 2024
Copy link
Member

@rolodato rolodato left a comment

Choose a reason for hiding this comment

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

Left a minor suggestion, either way it's an improvement and happy to ship it as-is 👍

@matthewelwell matthewelwell added this pull request to the merge queue Oct 28, 2024
Merged via the queue into main with commit 282d82f Oct 28, 2024
35 checks passed
@matthewelwell matthewelwell deleted the fix/sales-dashboard-search-500-error branch October 28, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants