forked from rDrama/rDrama
dedup effortpost protection and raise the limit from 1k to 3k characters
parent
cf9b4a017e
commit
f6f254307f
|
@ -510,3 +510,8 @@ class Comment(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS):
|
def emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS):
|
||||||
return get_emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS)
|
return get_emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def is_effortpost(self):
|
||||||
|
return False
|
||||||
|
|
|
@ -392,3 +392,8 @@ class Post(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS):
|
def emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS):
|
||||||
return get_emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS)
|
return get_emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def is_effortpost(self):
|
||||||
|
return len(self.body) >= 3000
|
||||||
|
|
|
@ -376,7 +376,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
|
||||||
if blackjack and execute_blackjack(v, None, sanitized, blackjack):
|
if blackjack and execute_blackjack(v, None, sanitized, blackjack):
|
||||||
return '<p>g</p>'
|
return '<p>g</p>'
|
||||||
|
|
||||||
if obj and not (isinstance(obj, Post) and len(obj.body) > 1000):
|
if obj and not obj.is_effortpost:
|
||||||
if author.owoify:
|
if author.owoify:
|
||||||
sanitized = owoify(sanitized, author.chud_phrase)
|
sanitized = owoify(sanitized, author.chud_phrase)
|
||||||
if author.marsify:
|
if author.marsify:
|
||||||
|
@ -676,7 +676,7 @@ def filter_emojis_only(title, golden=True, count_emojis=False, obj=None, author=
|
||||||
|
|
||||||
title = remove_cuniform(title)
|
title = remove_cuniform(title)
|
||||||
|
|
||||||
if obj and not (isinstance(obj, Post) and len(obj.body) > 1000):
|
if obj and not obj.is_effortpost:
|
||||||
if author.owoify:
|
if author.owoify:
|
||||||
title = owoify(title, author.chud_phrase)
|
title = owoify(title, author.chud_phrase)
|
||||||
if author.marsify:
|
if author.marsify:
|
||||||
|
|
|
@ -250,7 +250,7 @@ def award_thing(v, thing_type, id):
|
||||||
|
|
||||||
link = f"[this {thing_type}]({thing.shortlink})"
|
link = f"[this {thing_type}]({thing.shortlink})"
|
||||||
|
|
||||||
can_alter_body = not (isinstance(thing, Post) and len(thing.body) > 1000) and (not thing.author.deflector or v == thing.author)
|
can_alter_body = not thing.is_effortpost and (not thing.author.deflector or v == thing.author)
|
||||||
|
|
||||||
if kind == "ban":
|
if kind == "ban":
|
||||||
link = f"/{thing_type}/{thing.id}"
|
link = f"/{thing_type}/{thing.id}"
|
||||||
|
|
|
@ -550,10 +550,6 @@ def submit_post(v, hole=None):
|
||||||
|
|
||||||
if url == '': url = None
|
if url == '': url = None
|
||||||
|
|
||||||
flag_chudded = v.chud and hole != 'chudrama' and not (len(body) > 1000 and not v.chudded_by)
|
|
||||||
flag_queened = v.queen and len(body) <= 1000
|
|
||||||
flag_sharpened = v.sharpen and len(body) <= 1000
|
|
||||||
|
|
||||||
p = Post(
|
p = Post(
|
||||||
private=flag_private,
|
private=flag_private,
|
||||||
notify=flag_notify,
|
notify=flag_notify,
|
||||||
|
@ -568,12 +564,13 @@ def submit_post(v, hole=None):
|
||||||
title=title,
|
title=title,
|
||||||
hole=hole,
|
hole=hole,
|
||||||
ghost=flag_ghost,
|
ghost=flag_ghost,
|
||||||
chudded=flag_chudded,
|
|
||||||
rainbowed=bool(v.rainbow),
|
rainbowed=bool(v.rainbow),
|
||||||
queened=flag_queened,
|
|
||||||
sharpened=flag_sharpened,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
p.chudded = v.chud and hole != 'chudrama' and not (p.is_effortpost and not v.chudded_by)
|
||||||
|
p.queened = v.queen and not p.is_effortpost
|
||||||
|
p.sharpened = v.sharpen and not p.is_effortpost
|
||||||
|
|
||||||
title_html = filter_emojis_only(title, count_emojis=True, obj=p, author=v)
|
title_html = filter_emojis_only(title, count_emojis=True, obj=p, author=v)
|
||||||
|
|
||||||
if v.hieroglyphs and not marseyaward_title_regex.fullmatch(title_html):
|
if v.hieroglyphs and not marseyaward_title_regex.fullmatch(title_html):
|
||||||
|
|
Loading…
Reference in New Issue