Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Nov 2, 2023
1 parent b4d858d commit 5122c20
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ <h3 class="panel-title">

{# TODO Refactor, all of the forms are the same #}
{% macro copr_resubmit_allow_user_ssh_form(build, page, class="") %}
<form class="{{class}}" action="{{ copr_url('coprs_ns.copr_repeat_build', build.copr, build_id=build.id) }}" method="post">
<form class="{{class}}" action="{{ copr_url('coprs_ns.copr_repeat_build_ssh', build.copr, build_id=build.id) }}" method="post">
<input type="hidden" value="page" value="{{ page }}">
<button class="btn btn-default" type="submit">
<span class="pficon pficon-restart"></span> Resubmit and allow SSH
Expand Down
20 changes: 18 additions & 2 deletions frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,27 @@ def factory(**build_options):

################################ Repeat ################################

@coprs_ns.route("/<username>/<coprname>/repeat_build/<int:build_id>/", methods=["GET", "POST"])
@coprs_ns.route("/g/<group_name>/<coprname>/repeat_build/<int:build_id>/", methods=["GET", "POST"])
@coprs_ns.route("/<username>/<coprname>/repeat_build/<int:build_id>/",
methods=["GET", "POST"])
@coprs_ns.route("/g/<group_name>/<coprname>/repeat_build/<int:build_id>/",
methods=["GET", "POST"])
@login_required
@req_with_copr
def copr_repeat_build(copr, build_id):
return _copr_repeat_build(copr, build_id, False)


@coprs_ns.route("/<username>/<coprname>/repeat_build_ssh/<int:build_id>/",
methods=["GET", "POST"])
@coprs_ns.route("/g/<group_name>/<coprname>/repeat_build_ssh/<int:build_id>/",
methods=["GET", "POST"])
@login_required
@req_with_copr
def copr_repeat_build_ssh(copr, build_id):
return _copr_repeat_build(copr, build_id, True)


def _copr_repeat_build(copr, build_id, allow_user_ssh):
build = ComplexLogic.get_build_safe(build_id)
if not flask.g.user.can_build_in(build.copr):
flask.flash("You are not allowed to repeat this build.")
Expand Down

0 comments on commit 5122c20

Please sign in to comment.