roundabout,
created on Wednesday, 10 April 2024, 16:42:03 (1712767323),
received on Wednesday, 31 July 2024, 06:54:45 (1722408885)
Author identity: vlad <vlad.muntoiu@gmail.com>
00544a9d46412c65a7bdd8972a52751935e14540
app.py
@@ -819,6 +819,40 @@ def repository_forum_thread(username, repository, post_id):
) @repositories.route("/<username>/<repository>/forum/<int:post_id>/change-state", methods=["POST"]) def repository_forum_change_state(username, repository, post_id): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404) if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) app.logger.info(f"Loading {server_repo_location}") repo = git.Repo(server_repo_location) repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() user = User.query.filter_by(username=flask.session.get("username")).first() relationships = RepoAccess.query.filter_by(repo=repo_data) user_relationship = RepoAccess.query.filter_by(repo=repo_data, user=user).first() post = Post.query.filter_by(identifier=f"/{username}/{repository}/{post_id}").first() if not post: flask.abort(404) post.state = int(flask.request.form["new-state"]) db.session.commit() return flask.redirect( flask.url_for(".repository_forum_thread", username=username, repository=repository, post_id=post_id), code=303) @repositories.route("/<username>/<repository>/forum/<int:post_id>/reply", methods=["POST"]) def repository_forum_reply(username, repository, post_id): server_repo_location = os.path.join(config.REPOS_PATH, username, repository)
@@ -1255,9 +1289,11 @@ def repository_prs_merge_stage_two(username, repository, id):
) task_result = worker.AsyncResult(result.id) pull_request.state = 1 db.session.commit() return flask.redirect(f"/task/{result.id}?pr-id={id}", 303) # db.session.delete(pull_request) # db.session.commit()else: flask.abort(400)
@@ -1291,7 +1327,7 @@ def repository_prs_delete(username, repository):
pull_request = db.session.get(PullRequest, id) if pull_request: db.session.delete(pull_request)pull_request.state = 2db.session.commit() return flask.redirect(".", 303)
static/style.css
@@ -11,6 +11,8 @@
--color-rejected-text: #ffffff; --color-merged: #9c27b0; --color-merged-text: #ffffff; --color-done: #607D8B; --color-done-text: #ffffff;--color-insertion: #00C85366; --color-insertion-line-number: #00C853; --color-insertion-text: currentColor;
@@ -224,6 +226,12 @@ hr {
margin: 0; } .state-label-2 { text-transform: uppercase; padding: 0.5em; margin: 0; } .breadcrumbs > x-buttonbox iconify-icon { font-size: 1.5rem; }
templates/favourites.html
@@ -9,7 +9,7 @@
<x-vbox> <x-frame style="--width: 896px;" class="flexible-space"> <x-vbox> {% if favourites|length > 0 %}{% if favourites.count() > 0 %}{% for favourite in favourites %} <article class="card card-horizontal"> <section class="card-main flexible-space">
templates/repository/repo-forum-thread.html
@@ -13,6 +13,20 @@
<iconify-icon icon="mdi:arrow-left"></iconify-icon> </a> <h1>{{ parent.subject }}</h1> <div class="flexible-space"></div> <form action="{{ parent.number }}/change-state" method="post"> {% if parent.state == 0 %} <button type="submit" name="new-state" value="1" style="background: var(--color-done); color: var(--color-done-text);"> {% trans %}done{% endtrans %} </button> {% elif parent.state == 1 %} <button type="submit" name="new-state" value="0" style="background: var(--color-pending); color: var(--color-pending-text);"> {% trans %}active{% endtrans %} </button> {% endif %} </form>{% else %} <a href="." class="button icon-button"> <iconify-icon icon="mdi:arrow-left"></iconify-icon>
templates/repository/repo-forum.html
@@ -26,9 +26,15 @@
</details> {% for post in Post.query.filter_by(repo=repo_data, parent=none).order_by(Post.last_updated.desc()) %} <article class="card card-horizontal"> <figure class="branch-icon"><iconify-icon icon="mdi:note"></iconify-icon></figure>{% if post.state == 0 %} <div class="card-top state-label" style="background: var(--color-done); color: var(--color-done-text);"> {% trans %}done{% endtrans %} </div> {% elif post.state == 1 %} <div class="card-top state-label" style="background: var(--color-pending); color: var(--color-pending-text);"> {% trans %}active{% endtrans %} </div> {% endif %}<section class="card-main"> <h3><a href="{{ post.number }}">{{ post.subject }}</a> ({{ post.children | length }})</h3> <p><a href="/{{ post.owner.username }}">{{ post.owner.username }}</a></p>