~edwargix/git.sr.ht

95f9f1e5399cef6808abdcf7fd63c6557794c51e — Adnan Maolood 2 years ago 26f3346
gitsrht/blueprints/api: Accept lowercase visibility

Fixes: https://todo.sr.ht/~sircmpwn/git.sr.ht/361
2 files changed, 7 insertions(+), 0 deletions(-)

M gitsrht/blueprints/api/info.py
M gitsrht/repos.py
M gitsrht/blueprints/api/info.py => gitsrht/blueprints/api/info.py +2 -0
@@ 40,6 40,8 @@ def repos_POST():
    resp = current_app.repo_api.create_repo(valid, user)
    if not valid.ok:
        return valid.response
    # Convert visibility back to lowercase
    resp["visibility"] = resp["visibility"].lower()
    return resp, 201

@info.route("/api/repos/<reponame>", defaults={"username": None})

M gitsrht/repos.py => gitsrht/repos.py +5 -0
@@ 91,6 91,11 @@ class GitRepoApi():
        if not valid.ok:
            return None

        # Convert the visibility to uppercase. This is needed for the REST API
        # TODO: Remove this when the REST API is phased out
        if visibility is not None:
            visibility = visibility.upper()

        resp = exec_gql("git.sr.ht", """
            mutation CreateRepository(
                    $name: String!,