-
Notifications
You must be signed in to change notification settings - Fork 26
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
Auto org selection with cross-org object switcher #5823
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5823 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 459 460 +1
Lines 25127 25178 +51
=========================================
+ Hits 25127 25178 +51 ☔ View full report in Codecov by Sentry. |
if user.is_staff: | ||
return org | ||
|
||
membership = org.get_membership(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this could be combined with line 77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it feels pretty clear as written to me, what are you proposing exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking line 77 could both filter by org id and user membership but it's fine keeping those separate
orgs = user.orgs.filter(is_active=True).order_by("-created_on") | ||
if orgs.count() > 0: | ||
# take the newest one | ||
choose_org = orgs[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not .first()
Decided to add Switch view for normal users when clicking on link for objects they have access to but aren't currently logged in to see. This is a draft, still needs more tests.