Commit bda7a88e6b9f990be03330421e5671965534ac0c

Thomas de Grivel 2024-05-14T15:12:20

wip public_access

diff --git a/lib/kmxgit_web/controllers/repository_controller.ex b/lib/kmxgit_web/controllers/repository_controller.ex
index f2c8238..a7ec994 100644
--- a/lib/kmxgit_web/controllers/repository_controller.ex
+++ b/lib/kmxgit_web/controllers/repository_controller.ex
@@ -96,11 +96,13 @@ defmodule KmxgitWeb.RepositoryController do
     if repo && Repository.owner?(repo, current_user) do
       org = repo.organisation
       changeset = RepositoryManager.change_repository(repo)
+      public_access = GitManager.public_access(Repository.full_slug(repo))
       conn
       |> assign(:action, Routes.repository_path(conn, :update, params["owner"], Repository.splat(repo)))
       |> assign(:changeset, changeset)
       |> assign_current_organisation(org)
       |> assign(:current_repository, repo)
+      |> assign(:public_access, public_access)
       |> assign(:repo, repo)
       |> render("edit.html")
     else
@@ -985,6 +987,7 @@ defmodule KmxgitWeb.RepositoryController do
     end
   end
   defp show_op(conn, op = :tree, %{tree: tree, git: git, org: org, path: path, repo: repo, user: user}) do
+    public_access = GitManager.public_access(Repository.full_slug(repo))
     git = git
     |> git_put_files(repo, tree, path, conn)
     |> git_put_release(repo, tree, conn)
@@ -1001,10 +1004,11 @@ defmodule KmxgitWeb.RepositoryController do
       |> assign(:current_repository, repo)
       |> assign(:disk_usage, Repository.disk_usage(repo))
       |> assign(:git, git)
-      |> assign(:repo, repo)
       |> assign(:members, Repository.members(repo))
       |> assign(:owner, org || user)
       |> assign(:path, path)
+      |> assign(:public_access, public_access)
+      |> assign(:repo, repo)
       |> assign(:tree, tree)
       |> assign(:tree_url, tree && Routes.repository_path(conn, :show, Repository.owner_slug(repo), Repository.splat(repo, ["_tree", tree] ++ (if path, do: String.split(path, "/"), else: []))))
       |> render("show.html")