mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-04 17:49:24 +01:00
add comment deletion
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
1e79ade47c
commit
daf14c136e
4 changed files with 24 additions and 5 deletions
2
run.sh
2
run.sh
|
@ -4,7 +4,7 @@ set -u
|
|||
|
||||
main() {
|
||||
kill -9 $(pgrep python3) || true
|
||||
kill -9 $(pgrep memcached) || true
|
||||
kill -9 $(pgrep gunicorn) || true
|
||||
|
||||
cd src
|
||||
python3 -m pip install gunicorn
|
||||
|
|
|
@ -96,7 +96,22 @@ Comment:
|
|||
```""",
|
||||
)
|
||||
|
||||
flask.flash(f"Comment #{comment_id} confirmed.")
|
||||
flask.flash(f"Comment #{comment.id} confirmed.")
|
||||
|
||||
return flask.redirect(flask.url_for("views.index"))
|
||||
|
||||
|
||||
@views.get("/delete/<int:comment_id>/<string:token>/", alias=True)
|
||||
@views.get("/delete/<int:comment_id>/<string:token>")
|
||||
def delete(comment_id: int, token: str):
|
||||
"""delete a comment"""
|
||||
|
||||
comment: models.Comment = models.Comment.query.filter_by(id=comment_id, token=token).first_or_404()
|
||||
|
||||
models.db.session.delete(comment)
|
||||
models.db.session.commit()
|
||||
|
||||
flask.flash(f"Comment #{comment.id} deleted.")
|
||||
|
||||
return flask.redirect(flask.url_for("views.index"))
|
||||
|
||||
|
@ -157,7 +172,11 @@ Visit the following URL to *confirm* your email:
|
|||
|
||||
{flask.request.url.rstrip("/")}{flask.url_for("views.confirm", comment_id=comment.id, token=comment.token)}
|
||||
|
||||
...Or paste it into your browser.""",
|
||||
Or you may delete the comment:
|
||||
|
||||
{flask.request.url.rstrip("/")}{flask.url_for("views.delete", comment_id=comment.id, token=comment.token)}
|
||||
|
||||
If clicking doesn't work - try pasting it into your browser, or running `curl`/`wget`/`axel` on it :)""",
|
||||
)
|
||||
except Exception:
|
||||
models.db.session.delete(comment)
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<details open>
|
||||
<summary>messages from the server</summary>
|
||||
{% for category, message in messages %}
|
||||
<div data-category="{{ category }}">{{ message | escape }}</div>
|
||||
<div><b>[{{ category | escape }}] {{ message | escape }}</b></div>
|
||||
{% endfor %}
|
||||
</details>
|
||||
{% endif %}
|
||||
|
|
|
@ -450,7 +450,7 @@
|
|||
</form>
|
||||
|
||||
<div align="center">
|
||||
<i>Report any impersonation to the owner of this website: Ari Archer.</i>
|
||||
<i>Report any impersonation, illegal/graphic content, and/or anything disturbing to the owner of this website: Ari Archer.</i>
|
||||
</div>
|
||||
|
||||
<div id="comments">
|
||||
|
|
Loading…
Add table
Reference in a new issue