diff --git a/files/classes/comment.py b/files/classes/comment.py index 236534af4..8f872d29c 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -137,6 +137,7 @@ class Comment(Base): slots_result = Column(String) blackjack_result = Column(String) casino_game_id = Column(Integer, ForeignKey("casino_games.id")) + chudded = Column(Boolean, default=False) oauth_app = relationship("OauthApp") post = relationship("Post", back_populates="comments") diff --git a/files/classes/post.py b/files/classes/post.py index 0e7ee5d64..708b9fc59 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -59,6 +59,7 @@ class Post(Base): embed = Column(String) new = Column(Boolean) notify = Column(Boolean) + chudded = Column(Boolean, default=False) author = relationship("User", primaryjoin="Post.author_id==User.id") oauth_app = relationship("OauthApp") diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index b663f446a..11ff1d22a 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -729,6 +729,7 @@ def torture_object(obj, torture_method): def complies_with_chud(obj): #check for cases where u should leave + if not obj.chudded: return True if not (obj.author.chud or obj.author.queen): return True if obj.author.marseyawarded: return True if isinstance(obj, Post): diff --git a/files/routes/comments.py b/files/routes/comments.py index c3a0b181b..26d123107 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -264,6 +264,8 @@ def comment(v:User): is_bot = v.client is not None and v.id not in PRIVILEGED_USER_BOTS + chudded = v.chud and not (posting_to_submission and post_target.sub == 'chudrama') + c = Comment(author_id=v.id, parent_submission=post_target.id if posting_to_submission else None, wall_user_id=post_target.id if not posting_to_submission else None, @@ -275,6 +277,7 @@ def comment(v:User): body_html=body_html, body=body, ghost=ghost, + chudded=chudded, ) c.upvotes = 1 diff --git a/files/routes/posts.py b/files/routes/posts.py index 28afb5321..b374c178b 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -596,6 +596,8 @@ def submit_post(v:User, sub=None): if url == '': url = None + flag_chudded = v.chud and sub != 'chudrama' + p = Post( private=flag_private, notify=flag_notify, @@ -611,7 +613,8 @@ def submit_post(v:User, sub=None): title=title, title_html=title_html, sub=sub, - ghost=flag_ghost + ghost=flag_ghost, + chudded=flag_chudded, ) g.db.add(p) diff --git a/files/templates/comments.html b/files/templates/comments.html index 70ac3d40f..7dbbd858c 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -242,7 +242,7 @@ {% endif %} {% set realbody = c.realbody(v) %} -
+
{% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}
{% else %} -+
+
{% if p.is_image %}
diff --git a/files/templates/post_listing.html b/files/templates/post_listing.html
index 5f02cdf90..c6583d6d2 100644
--- a/files/templates/post_listing.html
+++ b/files/templates/post_listing.html
@@ -96,7 +96,7 @@
{{ macros.post_meta(p) }}
+
{{p.realbody(v, listing=True) | safe}}
{% endif %}
diff --git a/migrations/20230623-make-chud-not-retroactive.sql b/migrations/20230623-make-chud-not-retroactive.sql
new file mode 100644
index 000000000..40f5f7b57
--- /dev/null
+++ b/migrations/20230623-make-chud-not-retroactive.sql
@@ -0,0 +1,5 @@
+alter table posts add column chudded bool default false;
+alter table comments add column chudded bool default false;
+
+alter table posts alter column chudded drop default;
+alter table comments alter column chudded drop default;
{% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}
@@ -117,7 +117,7 @@ {% endif %} -- + {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}
@@ -208,7 +208,7 @@ {% if not v_forbid_deleted %} {% if p.realbody(v, listing=True) %} -