allow 18+ emojis to be used with "emoji" award but only show their effect to ppl with "Disable 18+ warnings" on
parent
0b63277d2d
commit
c454887445
|
@ -314,10 +314,11 @@ class Comment(Base):
|
|||
def award_count(self, kind, v):
|
||||
return len([x for x in self.awards if x.kind == kind])
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def emoji_award_emojis(self):
|
||||
return [x.note for x in self.awards if x.kind == "emoji"]
|
||||
def emoji_award_emojis(self, v, OVER_18_EMOJIS):
|
||||
if v and v.over_18:
|
||||
return [x.note for x in self.awards if x.kind == "emoji"]
|
||||
return [x.note for x in self.awards if x.kind == "emoji" and x.note not in OVER_18_EMOJIS]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -262,10 +262,11 @@ class Post(Base):
|
|||
return 4
|
||||
return num
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def emoji_award_emojis(self):
|
||||
return [x.note for x in self.awards if x.kind == "emoji"]
|
||||
def emoji_award_emojis(self, v, OVER_18_EMOJIS):
|
||||
if v and v.over_18:
|
||||
return [x.note for x in self.awards if x.kind == "emoji"]
|
||||
return [x.note for x in self.awards if x.kind == "emoji" and x.note not in OVER_18_EMOJIS]
|
||||
|
||||
@lazy
|
||||
def realurl(self, v):
|
||||
|
|
|
@ -560,8 +560,6 @@ def award_thing(v, thing_type, id):
|
|||
emoji = g.db.query(Emoji).filter_by(name=award.note).one_or_none()
|
||||
if not emoji:
|
||||
abort(404, f'an Emoji with the name "{award.note}" was not found!')
|
||||
if emoji.over_18:
|
||||
abort(404, "You can't use 18+ emojis for this award!")
|
||||
elif IS_HOMOWEEN():
|
||||
if kind == "spider":
|
||||
if author.spider: author.spider += 86400
|
||||
|
|
|
@ -12,6 +12,7 @@ from files.classes.user import User
|
|||
from files.classes.orgy import get_orgy
|
||||
from files.helpers.assetcache import assetcache_path
|
||||
from files.helpers.config.const import *
|
||||
from files.helpers.const_stateful import OVER_18_EMOJIS
|
||||
from files.helpers.regex import *
|
||||
from files.helpers.settings import *
|
||||
from files.helpers.cloudflare import *
|
||||
|
@ -143,7 +144,7 @@ def inject_constants():
|
|||
"SITE_FULL_IMAGES": SITE_FULL_IMAGES,
|
||||
"IS_EVENT":IS_EVENT, "IS_FISTMAS":IS_FISTMAS, "IS_HOMOWEEN":IS_HOMOWEEN,
|
||||
"IS_DKD":IS_DKD, "IS_BIRTHGAY":IS_BIRTHGAY, "IS_BIRTHDEAD":IS_BIRTHDEAD,
|
||||
"CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr, "calc_users":calc_users, "HOLE_INACTIVITY_DELETION":HOLE_INACTIVITY_DELETION, "LIGHT_THEMES":LIGHT_THEMES,
|
||||
"CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr, "calc_users":calc_users, "HOLE_INACTIVITY_DELETION":HOLE_INACTIVITY_DELETION, "LIGHT_THEMES":LIGHT_THEMES, "OVER_18_EMOJIS":OVER_18_EMOJIS,
|
||||
"MAX_IMAGE_AUDIO_SIZE_MB":MAX_IMAGE_AUDIO_SIZE_MB, "MAX_IMAGE_AUDIO_SIZE_MB_PATRON":MAX_IMAGE_AUDIO_SIZE_MB_PATRON,
|
||||
"MAX_VIDEO_SIZE_MB":MAX_VIDEO_SIZE_MB, "MAX_VIDEO_SIZE_MB_PATRON":MAX_VIDEO_SIZE_MB_PATRON,
|
||||
"CURSORMARSEY_DEFAULT":CURSORMARSEY_DEFAULT, "SNAPPY_ID":SNAPPY_ID, "get_orgy":get_orgy, "TRUESCORE_CC_CHAT_MINIMUM":TRUESCORE_CC_CHAT_MINIMUM, "bar_position":bar_position,
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
{% if p.award_count("emoji", v) %}
|
||||
<div class="stackable-container">
|
||||
{% for emoji in p.emoji_award_emojis %}
|
||||
{% for emoji in p.emoji_award_emojis(v, OVER_18_EMOJIS) %}
|
||||
{% set src = '/e/' + emoji + '.webp' %}
|
||||
{% set alt = ':#' + emoji + ':' %}
|
||||
<div class="emoji-award">
|
||||
|
|
Loading…
Reference in New Issue