fix leak of deleted content

This commit is contained in:
justcool393 2023-03-14 12:05:25 -05:00
parent fb65cf0416
commit 24af1b4433
4 changed files with 32 additions and 0 deletions

View file

@ -1,6 +1,7 @@
from os import environ
import re
import time
from typing import Optional
from urllib.parse import urlencode, urlparse, parse_qs
from flask import *
from sqlalchemy import *
@ -8,6 +9,7 @@ from sqlalchemy.orm import relationship
from files.__main__ import Base, app
from files.classes.votes import CommentVote
from files.helpers.const import *
from files.helpers.content import moderated_body
from files.helpers.lazy import lazy
from .flags import CommentFlag
from random import randint
@ -331,6 +333,8 @@ class Comment(Base):
return data
def realbody(self, v):
moderated:Optional[str] = moderated_body(self, v)
if moderated: return moderated
if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"<p>{CC} ONLY</p>"
body = self.body_html or ""
@ -371,6 +375,8 @@ class Comment(Base):
return body
def plainbody(self, v):
moderated:Optional[str] = moderated_body(self, v)
if moderated: return moderated
if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"<p>{CC} ONLY</p>"
body = self.body
if not body: return ""