From f3ff44203c0c20024af6a217bfa236203b322163 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 23 Apr 2022 20:53:38 +0100 Subject: [PATCH] Add is_status_update to thread replies --- app/blueprints/packages/reviews.py | 1 + app/models/threads.py | 2 ++ app/scss/comments.scss | 4 +++ app/templates/base.html | 2 +- app/templates/macros/threads.html | 47 +++++++++++++++++++++++----- migrations/versions/8807a5279793_.py | 23 ++++++++++++++ 6 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 migrations/versions/8807a5279793_.py diff --git a/app/blueprints/packages/reviews.py b/app/blueprints/packages/reviews.py index a5b194c7..10edf644 100644 --- a/app/blueprints/packages/reviews.py +++ b/app/blueprints/packages/reviews.py @@ -145,6 +145,7 @@ def delete_review(package, reviewer): reply.thread = thread reply.author = current_user reply.comment = "_converted review into a thread_" + reply.is_status_update = True db.session.add(reply) thread.review = None diff --git a/app/models/threads.py b/app/models/threads.py index 58f5ade4..a344aefc 100644 --- a/app/models/threads.py +++ b/app/models/threads.py @@ -136,6 +136,8 @@ class ThreadReply(db.Model): author_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False) author = db.relationship("User", back_populates="replies", foreign_keys=[author_id]) + is_status_update = db.Column(db.Boolean, server_default="0", nullable=False) + created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow) def get_url(self): diff --git a/app/scss/comments.scss b/app/scss/comments.scss index af72bf9e..5e8d5ab9 100644 --- a/app/scss/comments.scss +++ b/app/scss/comments.scss @@ -32,4 +32,8 @@ height: 60px; object-fit: cover; } + + .status-update p { + margin: 0; + } } diff --git a/app/templates/base.html b/app/templates/base.html index 8c6eb411..7a3c5b8a 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -6,7 +6,7 @@ {% block title %}title{% endblock %} - {{ config.USER_APP_NAME }} - + diff --git a/app/templates/macros/threads.html b/app/templates/macros/threads.html index 3c8b11dc..518f1fa9 100644 --- a/app/templates/macros/threads.html +++ b/app/templates/macros/threads.html @@ -1,9 +1,6 @@ -{% macro render_thread(thread, current_user, form=None) -%} +{% macro render_reply(r, thread, current_user) -%} + {% from "macros/reviews.html" import render_review_vote %} -{% from "macros/reviews.html" import render_review_vote %} - -