Skip to content

Commit

Permalink
Merge pull request #453 from GooeyAI/save-for-anon-users
Browse files Browse the repository at this point in the history
fix: ux behavior on save for anonymous users
  • Loading branch information
nikochiko authored Oct 7, 2024
2 parents 679be6c + 94ca8b5 commit b89383a
Show file tree
Hide file tree
Showing 4 changed files with 364 additions and 200 deletions.
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

0 comments on commit b89383a

Please sign in to comment.