forked from rDrama/rDrama
sfd
parent
ccd818bb03
commit
ddf0a44cfe
|
@ -39,7 +39,7 @@ class Comment(Base):
|
||||||
upvotes = Column(Integer, default=1)
|
upvotes = Column(Integer, default=1)
|
||||||
downvotes = Column(Integer, default=0)
|
downvotes = Column(Integer, default=0)
|
||||||
body = deferred(Column(String(20000)))
|
body = deferred(Column(String(20000)))
|
||||||
body_html = Column(String(40000))
|
body_html = deferred(Column(String(40000)))
|
||||||
ban_reason = Column(String(256))
|
ban_reason = Column(String(256))
|
||||||
|
|
||||||
post = relationship("Submission", viewonly=True)
|
post = relationship("Submission", viewonly=True)
|
||||||
|
@ -284,7 +284,7 @@ class Comment(Base):
|
||||||
body = self.body_html
|
body = self.body_html
|
||||||
|
|
||||||
if not body: return ""
|
if not body: return ""
|
||||||
|
|
||||||
if not v or v.slurreplacer:
|
if not v or v.slurreplacer:
|
||||||
for s, r in SLURS.items(): body = body.replace(s, r)
|
for s, r in SLURS.items(): body = body.replace(s, r)
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ def api_comment(v):
|
||||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
|
|
||||||
if len(body_html) > 20000: abort(400)
|
if len(body_html) > 40000: abort(400)
|
||||||
|
|
||||||
c = Comment(author_id=v.id,
|
c = Comment(author_id=v.id,
|
||||||
parent_submission=parent_submission,
|
parent_submission=parent_submission,
|
||||||
|
@ -691,7 +691,7 @@ def edit_comment(cid, v):
|
||||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
|
|
||||||
if len(body_html) > 20000: abort(400)
|
if len(body_html) > 40000: abort(400)
|
||||||
|
|
||||||
c.body = body[:10000]
|
c.body = body[:10000]
|
||||||
c.body_html = body_html
|
c.body_html = body_html
|
||||||
|
|
Loading…
Reference in New Issue