~comcloudway/builds.sr.ht

1138d51dc437fbc5cc0d45ae18c6902b259f26b1 — Noelle Leigh 2 years ago 6670a94
jobs.resubmit_GET: only add suffix to 1 line notes

The number of considerations required to safely truncate a block of
multiline Markdown without mangling the formatting is quite large, so
instead we settle for appending "(resubmitted)" only to notes which have
a single line.
1 files changed, 5 insertions(+), 1 deletions(-)

M buildsrht/blueprints/jobs.py
M buildsrht/blueprints/jobs.py => buildsrht/blueprints/jobs.py +5 -1
@@ 205,7 205,11 @@ def resubmit_GET(job_id):
    if not job:
        abort(404)
    session["manifest"] = job.manifest
    session["note"] = addsuffix(job.note, "(resubmitted)")
    if isinstance(job.note, str) and len(job.note.splitlines()) == 1:
        note = addsuffix(job.note, "(resubmitted)")
    else:
        note = job.note
    session["note"] = note
    return redirect("/submit")

@jobs.route("/submit", methods=["POST"])