-
Notifications
You must be signed in to change notification settings - Fork 2
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
move handles from appuser to workspace (with fallback) #585
base: master
Are you sure you want to change the base?
Conversation
workspace, _ = self.get_or_create_personal_workspace() | ||
|
||
if handle := Handle.create_default_for_user(user=self): | ||
workspace.handle = handle | ||
workspace.save() |
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.
for new users, handle should be on the workspace
def get_handle(self) -> Handle | None: | ||
if self.handle: | ||
return self.handle | ||
workspace, _ = self.get_or_create_personal_workspace() | ||
return workspace.handle |
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.
cache get_or_create_personal_workspace()
?
if show_as_link and workspace.is_personal and workspace.created_by.handle: | ||
link = workspace.created_by.handle.get_app_url() | ||
if show_as_link and workspace.is_personal: | ||
handle = workspace.handle or workspace.created_by.handle |
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.
not using workspace.created_by.get_handle()
because personal workspace already
handle = user.get_handle() | ||
assert handle |
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.
assert (handle := user.get_handle())
is also valid python
migrations.AlterField( | ||
model_name='appuser', | ||
name='handle', | ||
field=models.OneToOneField(blank=True, default=None, help_text='[deprecated] use workspace.handle instead', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user', to='handles.handle'), |
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.
adds help_text='[deprecated] ...
here
if ( | ||
self.has_workspace | ||
and self.has_user | ||
and self.workspace.created_by_id == self.user.id | ||
): | ||
# TODO: remove this once all handles are migrated | ||
return |
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.
to handle an in-between state where the same handle can be attached to a personal workspace & its user. won't be needed after cleanup_handles()
is run in the script
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.
PR Summary
Hi! Looks like you've reached your API usage limit. You can increase it from your account settings page here: app.greptile.com/settings/usage
14 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
missed? gooey-server/workspaces/views.py Line 468 in bd355fa
|
user_profile_page(request, handle.user) | ||
return dict(meta=get_meta_tags_for_profile(handle.user)) | ||
user_profile_page(request, user) | ||
return dict(meta=get_meta_tags_for_profile(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.
pass handle into user_profile_page
/ get_meta_tags_for_profile
directly instead of doing a 2x lookup
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.
done
routers/account.py
Outdated
@@ -329,11 +329,11 @@ def _render_run(pr: PublishedRun): | |||
return | |||
|
|||
if workspace.is_personal: | |||
if request.user.handle: | |||
if handle := request.user.get_handle(): |
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.
this should be workspace.handle
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.
done
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.
PR Summary
(updates since last review)
Hi! Looks like you've reached your API usage limit. You can increase it from your account settings page here: app.greptile.com/settings/usage
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
PR Summary
(updates since last review)
Hi! Looks like you've reached your API usage limit. You can increase it from your account settings page here: app.greptile.com/settings/usage
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
thanks, fixed. |
Q/A checklist
You can visualize this using tuna:
To measure import time for a specific library:
To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:
Legal Boilerplate
Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.