roundabout,
created on Sunday, 28 July 2024, 14:07:44 (1722175664),
received on Wednesday, 31 July 2024, 06:54:51 (1722408891)
Author identity: vlad <vlad.muntoiu@gmail.com>
5bf16561ca2a2116a4bec12a42f8c4aa3aaf5344
models.py
@@ -308,7 +308,7 @@ with (app.app_context()):
foreign_keys="[Post.parent_id]", remote_side="Post.identifier")
root = db.relationship("Post",
primaryjoin="Post.root_id==Post.identifier",
foreign_keys="[Post.root_id]", remote_side="Post.identifier")
foreign_keys="[Post.root_id]", remote_side="Post.identifier", post_update=True)
children = db.relationship("Post",
remote_side="Post.parent_id",
primaryjoin="Post.identifier==Post.parent_id",
@@ -327,12 +327,10 @@ with (app.app_context()):
self.message = message
self.html = markdown.markdown2html(message).prettify()
self.parent = parent
if parent and parent.parent:
self.root = parent.parent
elif parent:
self.root = parent
if parent:
self.root = parent.root
else:
self.root = None
self.root = self
repo.last_post_id += 1
notification = Notification({"type": "post", "repo": repo.route, "post": self.identifier})
templates/repository/repo-forum-thread.html
@@ -8,32 +8,25 @@
<script src="/static/voting.js"></script>
<x-vbox style="--gap-box: 0;">
<x-buttonbox id="forum-banner" class="box-center">
{% if not parent.root %}
<a href="." class="button icon-button">
<iconify-icon icon="mdi:arrow-left"></iconify-icon>
</a>
<h1>{{ parent.subject }}</h1>
<a href="." class="button icon-button">
<iconify-icon icon="mdi:arrow-left"></iconify-icon>
</a>
<h1>{{ parent.root.subject }}</h1>
<div class="flexible-space"></div>
<div class="flexible-space"></div>
{% if has_permission %}
<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>
{% endif %}
{% else %}
<a href="." class="button icon-button">
<iconify-icon icon="mdi:arrow-left"></iconify-icon>
</a>
<h1>{{ parent.root.subject }}</h1>
{% if has_permission %}
<form action="{{ parent.root.number }}/change-state" method="post">
{% if parent.root.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.root.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>
{% endif %}
</x-buttonbox>
<x-frame style="--width: 896px;" class="flexible-space">