roundabout,
created on Thursday, 1 February 2024, 15:12:23 (1706800343),
received on Wednesday, 31 July 2024, 06:54:41 (1722408881)
Author identity: vlad <vlad.muntoiu@gmail.com>
71b0825a1124c932f96c9b0bf839fef201fd3e75
app.py
@@ -932,10 +932,28 @@ def repository_prs(username, repository):
else: repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() head = flask.request.form.get("head") head_route = flask.request.form.get("headroute")base = flask.request.form.get("base") base_route = flask.request.form.get("baseroute")if not head and base:flask.abort(400)if not head and base and head_route and base_route: return flask.redirect(".", 400) head_repo = git.Repo(os.path.join(server_repo_location, head_route.lstrip("/"))) base_repo = git.Repo(os.path.join(server_repo_location, base_route.lstrip("/"))) if head not in head_repo or base not in base_repo: flask.flash(Markup( "<iconify-icon icon='mdi:error'></iconify-icon>Bad branch name"), category="error") return flask.redirect(".", 400) head_data = db.session.get(Repo, head_repo) if head_data.visibility != 1: flask.flash(Markup( "<iconify-icon icon='mdi:error'></iconify-icon>Head can't be restricted"), category="error") return flask.redirect(".", 400)pull_request = PullRequest(repo_data, head, repo_data, base, db.session.get(User, flask.session["username"])) db.session.add(pull_request)
templates/repository/repo-prs.html
@@ -8,22 +8,18 @@
<x-frame style="--width: 896px;" class="flexible-space"> <form method="post"> <x-hbox> <select name="head" style="flex: 0 1 auto;" required><option value="" selected>===Head branch===</option>{% for branch in branches %}<option value="{{ branch }}">{{ branch }}</option>{% endfor %}</select><input name="headroute" value="{{ repo_data.route }}" required> <input name="head" style="flex: 0 1 auto;" required placeholder="Head branch"><iconify-icon icon="mdi-light:arrow-right" style="font-size: 2em;"></iconify-icon> <select name="base" style="flex: 0 1 auto;" required> <option value="" selected>===Base branch===</option><option value="" selected>Base branch</option>{% for branch in branches %} <option value="{{ branch }}">{{ branch }}</option> {% endfor %} </select> <button type="submit">Send PR</button><button type="submit">Request merging</button></x-hbox> </form> </x-frame>