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

show "Public" visibility for already public published runs in team workspace #587

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 8 additions & 6 deletions bots/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import datetime
import typing
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -40,14 +42,14 @@ class PublishedRunVisibility(models.IntegerChoices):
INTERNAL = 3

@classmethod
def choices_for_workspace(
cls, workspace: typing.Optional["Workspace"]
) -> typing.Iterable["PublishedRunVisibility"]:
if not workspace or workspace.is_personal:
return [cls.UNLISTED, cls.PUBLIC]
def choices_for_pr(
cls, pr: PublishedRun
) -> typing.Iterable[PublishedRunVisibility]:
if not pr.workspace or pr.workspace.is_personal:
return {cls.UNLISTED, cls.PUBLIC, PublishedRunVisibility(pr.visibility)}
else:
# TODO: Add cls.PUBLIC when team-handles are added
return [cls.UNLISTED, cls.INTERNAL]
return {cls.UNLISTED, cls.INTERNAL, PublishedRunVisibility(pr.visibility)}

@classmethod
def get_default_for_workspace(cls, workspace: typing.Optional["Workspace"]):
Expand Down
4 changes: 1 addition & 3 deletions daras_ai_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,7 @@ def _render_share_modal(self, dialog: gui.AlertDialogRef):

options = {
str(enum.value): enum.help_text(self.current_pr.workspace)
for enum in PublishedRunVisibility.choices_for_workspace(
self.current_pr.workspace
)
for enum in PublishedRunVisibility.choices_for_pr(self.current_pr)
}
published_run_visibility = PublishedRunVisibility(
int(
Expand Down
Loading