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: ux behavior on save for anonymous users #453

Merged
merged 18 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
231e9ef
Fix save flow for anonymous users
nikochiko Sep 16, 2024
fd0ea16
feat: add save as new button on update and reorder top-right buttons …
nikochiko Sep 17, 2024
db69996
Fix text for anon users and version history icon
nikochiko Sep 18, 2024
c45dcf0
keep unsaved changes to request in an unqueued run - start when user …
nikochiko Sep 19, 2024
3283ced
simplify and remove impossible cases
nikochiko Sep 19, 2024
a4c7427
put redirect for anon user vs open publish dialog in an if-else for c…
nikochiko Sep 19, 2024
ffdb644
fix create_new_run->create_and_validate_new_run when publishing for a…
nikochiko Sep 19, 2024
9d2e60d
Add RecipeRunState.standby
nikochiko Sep 23, 2024
5249797
Refactor logic to publish_and_redirect for clarity
nikochiko Sep 23, 2024
2c43095
fix buttons for padding
nikochiko Sep 23, 2024
bf27df5
Revert "fix buttons for padding"
nikochiko Sep 23, 2024
524122b
fix padding on dialogs
nikochiko Sep 23, 2024
222f5c0
only show Update & Options button on Run tab
nikochiko Sep 23, 2024
fdee7fc
redo copy_to_clipboard_button to run javascript after hitting the ser…
nikochiko Sep 23, 2024
8c0e52e
Revert "redo copy_to_clipboard_button to run javascript after hitting…
nikochiko Oct 3, 2024
0bb1b7f
replace current_sr_user.uid with current_sr.uid for clarity
nikochiko Oct 3, 2024
f8497ae
add new copy_to_clipboard_button_with_return to return some boolean b…
nikochiko Oct 3, 2024
94ca8b5
fix: consider case when self.request.user is None as anon user for re…
nikochiko Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions bots/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
from app_users.models import AppUser
from bots.admin_links import open_in_new_tab
from bots.custom_fields import PostgresJSONEncoder, CustomURLField
from daras_ai_v2 import icons
from daras_ai_v2.crypto import get_random_doc_id
from daras_ai_v2.language_model import format_chat_entry
from functions.models import CalledFunction, CalledFunctionResponse
from functions.models import CalledFunctionResponse
from gooeysite.bg_db_conn import get_celery_result_db_safe
from gooeysite.custom_create import get_or_create_lazy

Expand All @@ -38,20 +39,23 @@ class PublishedRunVisibility(models.IntegerChoices):
def help_text(self):
match self:
case PublishedRunVisibility.UNLISTED:
return "Only me + people with a link"
return f"{self.get_icon()} Only me + people with a link"
case PublishedRunVisibility.PUBLIC:
return "Public"
case _:
return self.label
return f"{self.get_icon()} Public"

def get_icon(self):
match self:
case PublishedRunVisibility.UNLISTED:
return icons.lock
case PublishedRunVisibility.PUBLIC:
return icons.globe

def get_badge_html(self):
match self:
case PublishedRunVisibility.UNLISTED:
return '<i class="fa-regular fa-lock"></i> Private'
return f"{self.get_icon()} Private"
case PublishedRunVisibility.PUBLIC:
return '<i class="fa-regular fa-globe"></i> Public'
case _:
raise NotImplementedError(self)
return f"{self.get_icon()} Public"


class Platform(models.IntegerChoices):
Expand Down
Loading
Loading