rename over_18 to nsfw

master
Aevann 2023-10-05 13:19:50 +03:00
parent cb19abcff5
commit bb7192c929
29 changed files with 88 additions and 85 deletions

View File

@ -5,7 +5,7 @@ function approve_emoji(t, name) {
"tags": document.getElementById(`${name}-tags`).value,
"name": document.getElementById(`${name}-name`).value,
"kind": document.getElementById(`${name}-kind`).value,
"over_18": document.getElementById(`${name}-nsfw`).checked,
"nsfw": document.getElementById(`${name}-nsfw`).checked,
},
() => {
document.getElementById(`${name}-emoji`).remove()

View File

@ -174,7 +174,7 @@ class Comment(Base):
level = Column(Integer, default=1)
parent_comment_id = Column(Integer, ForeignKey("comments.id"))
top_comment_id = Column(Integer)
over_18 = Column(Boolean, default=False)
nsfw = Column(Boolean, default=False)
is_bot = Column(Boolean, default=False)
stickied = Column(String)
stickied_utc = Column(Integer)
@ -322,7 +322,7 @@ class Comment(Base):
@lazy
def emoji_award_emojis(self, v, OVER_18_EMOJIS):
if g.show_over_18:
if g.show_nsfw:
return [x.note for x in self.awards if x.kind == "emoji"][:4]
return [x.note for x in self.awards if x.kind == "emoji" and x.note not in OVER_18_EMOJIS][:4]
@ -361,7 +361,7 @@ class Comment(Base):
'edited_utc': self.edited_utc or 0,
'is_banned': bool(self.is_banned),
'deleted_utc': self.deleted_utc,
'is_nsfw': self.over_18,
'is_nsfw': self.nsfw,
'permalink': f'/comment/{self.id}#context',
'stickied': self.stickied,
'distinguish_level': self.distinguish_level,
@ -435,7 +435,7 @@ class Comment(Base):
if comment_info: return False
if self.over_18 and not (any(path.startswith(x) for x in ('/post/','/comment/','/h/')) and self.post.over_18) and not g.show_over_18:
if self.nsfw and not (any(path.startswith(x) for x in ('/post/','/comment/','/h/')) and self.post.nsfw) and not g.show_nsfw:
return True
if self.is_banned: return True

View File

@ -15,7 +15,7 @@ class Emoji(Base):
count = Column(Integer, default=0)
submitter_id = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer)
over_18 = Column(Boolean, default=False)
nsfw = Column(Boolean, default=False)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())

View File

@ -45,7 +45,7 @@ class Post(Base):
private = Column(Boolean, default=False)
comment_count = Column(Integer, default=0)
is_approved = Column(Integer, ForeignKey("users.id"))
over_18 = Column(Boolean, default=False)
nsfw = Column(Boolean, default=False)
is_bot = Column(Boolean, default=False)
upvotes = Column(Integer, default=1)
downvotes = Column(Integer, default=0)
@ -168,7 +168,7 @@ class Post(Base):
@property
@lazy
def thumb_url(self):
if self.over_18:
if self.nsfw:
return f"{SITE_FULL_IMAGES}/i/nsfw.webp?x=6"
elif not self.url:
return f"{SITE_FULL_IMAGES}/i/{SITE_NAME}/default_text.webp?x=6"
@ -225,7 +225,7 @@ class Post(Base):
'created_utc': self.created_utc,
'id': self.id,
'title': self.title,
'is_nsfw': self.over_18,
'is_nsfw': self.nsfw,
'is_bot': self.is_bot,
'thumb_url': self.thumb_url,
'domain': self.domain,
@ -265,7 +265,7 @@ class Post(Base):
@lazy
def emoji_award_emojis(self, v, OVER_18_EMOJIS):
if g.show_over_18:
if g.show_nsfw:
return [x.note for x in self.awards if x.kind == "emoji"][:4]
return [x.note for x in self.awards if x.kind == "emoji" and x.note not in OVER_18_EMOJIS][:4]

View File

@ -284,8 +284,8 @@ class User(Base):
@property
@lazy
def over_18(self):
return bool(session.get('over_18'))
def nsfw(self):
return bool(session.get('nsfw'))
@property
@lazy

View File

@ -214,7 +214,7 @@ def execute_snappy(post, v):
distinguish_level=6,
parent_post=post.id,
level=1,
over_18=False,
nsfw=False,
is_bot=True,
app_id=None,
body=body,

View File

@ -19,9 +19,9 @@ def const_initialize():
db = db_session()
MARSEYS_CONST = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind == "Marsey", Emoji.submitter_id == None, Emoji.name != 'chudsey', Emoji.over_18 == False)]
MARSEYS_CONST = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind == "Marsey", Emoji.submitter_id == None, Emoji.name != 'chudsey', Emoji.nsfw == False)]
MARSEYS_CONST2 = MARSEYS_CONST + ['chudsey','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark']
marseys = db.query(Emoji).filter(Emoji.kind=="Marsey", Emoji.submitter_id == None, Emoji.over_18 == False).all()
marseys = db.query(Emoji).filter(Emoji.kind=="Marsey", Emoji.submitter_id == None, Emoji.nsfw == False).all()
for marsey in marseys:
for tag in marsey.tags.split():
if tag in MARSEY_MAPPINGS:
@ -29,12 +29,12 @@ def const_initialize():
else:
MARSEY_MAPPINGS[tag] = [marsey.name]
SNAPPY_KONGS = db.query(Emoji.name).filter(Emoji.kind=="Donkey Kong", Emoji.submitter_id==None, Emoji.over_18 == False).all()
SNAPPY_KONGS = db.query(Emoji.name).filter(Emoji.kind=="Donkey Kong", Emoji.submitter_id==None, Emoji.nsfw == False).all()
SNAPPY_KONGS = [f':#{x[0]}:' for x in SNAPPY_KONGS]
STEALTH_HOLES = [x[0] for x in db.query(Sub.name).filter_by(stealth=True)]
OVER_18_EMOJIS = [x[0] for x in db.query(Emoji.name).filter_by(over_18=True)]
OVER_18_EMOJIS = [x[0] for x in db.query(Emoji.name).filter_by(nsfw=True)]
db.commit()
db.close()

View File

@ -160,7 +160,7 @@ def _create_post(title, body, pin_hours):
private=False,
notify=True,
author_id=AUTOJANNY_ID,
over_18=False,
nsfw=False,
new=False,
app_id=None,
is_bot=False,

View File

@ -267,7 +267,7 @@ def find_all_emote_endings(emoji):
elif kind == 'Marseyalphabet': kind = 'Marsey Alphabet'
if kind in EMOJI_KINDS:
emoji = g.db.query(Emoji.name).filter_by(kind=kind, over_18=False).order_by(func.random()).first()[0]
emoji = g.db.query(Emoji.name).filter_by(kind=kind, nsfw=False).order_by(func.random()).first()[0]
return endings, emoji
@ -566,7 +566,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
if obj:
for emoji in emojis_used:
if emoji in OVER_18_EMOJIS:
obj.over_18 = True
obj.nsfw = True
break
sanitized = sanitized.replace('<p></p>', '')
@ -731,7 +731,7 @@ def filter_emojis_only(title, golden=True, count_emojis=False, obj=None):
if obj:
for emoji in emojis_used:
if emoji in OVER_18_EMOJIS:
obj.over_18 = True
obj.nsfw = True
break
title = strikethrough_regex.sub(r'\1<del>\2</del>', title)

View File

@ -48,7 +48,7 @@ def submit_emoji(v):
tags = request.values.get('tags', '').lower().strip()
username = request.values.get('author', '').lower().strip()
kind = request.values.get('kind', '').strip()
over_18 = bool(request.values.get("over_18"))
nsfw = bool(request.values.get("nsfw"))
for modifier in emoji_modifiers:
if name.endswith(modifier):
@ -99,7 +99,7 @@ def submit_emoji(v):
tags=tags,
count=0,
submitter_id=v.id,
over_18=over_18,
nsfw=nsfw,
)
g.db.add(emoji)
@ -148,12 +148,12 @@ def approve_emoji(v, name):
if new_kind not in EMOJI_KINDS:
abort(400, "Invalid kind!")
over_18 = request.values.get("over_18") == 'true'
nsfw = request.values.get("nsfw") == 'true'
emoji.name = new_name
emoji.kind = new_kind
emoji.tags = tags
emoji.over_18 = over_18
emoji.nsfw = nsfw
g.db.add(emoji)
author = get_account(emoji.author_id)
@ -188,8 +188,8 @@ def approve_emoji(v, name):
badge_grant(badge_id=113, user=author)
badge_grant(badge_id=112, user=author)
cache.delete(f"emojis_{emoji.over_18}")
cache.delete(f"emoji_list_{emoji.kind}_{emoji.over_18}")
cache.delete(f"emojis_{emoji.nsfw}")
cache.delete(f"emoji_list_{emoji.kind}_{emoji.nsfw}")
purge_files_in_cloudflare_cache(f"{SITE_FULL_IMAGES}/e/{emoji.name}/webp")
@ -230,7 +230,7 @@ def approve_emoji(v, name):
)
g.db.add(ma)
if emoji.over_18:
if emoji.nsfw:
OVER_18_EMOJIS.append(emoji.name)
return {"message": f"'{emoji.name}' approved!"}
@ -512,8 +512,8 @@ def update_emoji(v):
)
g.db.add(ma)
cache.delete(f"emojis_{existing.over_18}")
cache.delete(f"emoji_list_{existing.kind}_{existing.over_18}")
cache.delete(f"emojis_{existing.nsfw}")
cache.delete(f"emoji_list_{existing.kind}_{existing.nsfw}")
return {"message": f"'{name}' updated successfully!"}

View File

@ -63,7 +63,7 @@ def post_pid_comment_cid(cid, v, pid=None, anything=None, sub=None):
post = get_post(post, v=v)
if not (v and v.client) and post.over_18 and not g.show_over_18:
if not (v and v.client) and post.nsfw and not g.show_nsfw:
return render_template("errors/nsfw.html", v=v), 403
try: context = min(int(request.values.get("context", 8)), 8)
@ -270,7 +270,7 @@ def comment(v):
wall_user_id=post_target.id if not posting_to_post else None,
parent_comment_id=parent_comment_id,
level=level,
over_18=post_target.over_18 if posting_to_post else False,
nsfw=post_target.nsfw if posting_to_post else False,
is_bot=is_bot,
app_id=v.client.application.id if v.client else None,
body=body,
@ -618,16 +618,16 @@ def toggle_comment_nsfw(cid, v):
if comment.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION'] and not (comment.post.sub and v.mods(comment.post.sub)):
abort(403)
if comment.over_18 and v.is_permabanned:
if comment.nsfw and v.is_permabanned:
abort(403)
comment.over_18 = not comment.over_18
comment.nsfw = not comment.nsfw
g.db.add(comment)
if comment.author_id != v.id:
if v.admin_level >= PERMS['POST_COMMENT_MODERATION']:
ma = ModAction(
kind = "set_nsfw_comment" if comment.over_18 else "unset_nsfw_comment",
kind = "set_nsfw_comment" if comment.nsfw else "unset_nsfw_comment",
user_id = v.id,
target_comment_id = comment.id,
)
@ -635,13 +635,13 @@ def toggle_comment_nsfw(cid, v):
else:
ma = SubAction(
sub = comment.post.sub,
kind = "set_nsfw_comment" if comment.over_18 else "unset_nsfw_comment",
kind = "set_nsfw_comment" if comment.nsfw else "unset_nsfw_comment",
user_id = v.id,
target_comment_id = comment.id,
)
g.db.add(ma)
if comment.over_18: return {"message": "Comment has been marked as NSFW!"}
if comment.nsfw: return {"message": "Comment has been marked as NSFW!"}
else: return {"message": "Comment has been unmarked as NSFW!"}
@app.post("/edit_comment/<int:cid>")

View File

@ -65,6 +65,6 @@ def error_500(e):
@limiter.limit('1/second', scope=rpath)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
def allow_nsfw():
session["over_18_cookies"] = int(time.time()) + 3600
session["nsfw_cookies"] = int(time.time()) + 3600
redir = request.values.get("redir", "/")
return '', 204

View File

@ -102,7 +102,7 @@ def post_id(pid, v, anything=None, sub=None):
p = get_post(pid, v=v)
if not can_see(v, p): abort(403)
if not g.is_api_or_xhr and p.over_18 and not g.show_over_18:
if not g.is_api_or_xhr and p.nsfw and not g.show_nsfw:
return render_template("errors/nsfw.html", v=v)
gevent.spawn(_add_post_view, pid)
@ -539,7 +539,7 @@ def submit_post(v, sub=None):
flag_notify = (request.values.get("notify", "on") == "on")
flag_new = request.values.get("new", False, bool) or 'megathread' in title.lower()
flag_over_18 = FEATURES['NSFW_MARKING'] and request.values.get("over_18", False, bool)
flag_nsfw = FEATURES['NSFW_MARKING'] and request.values.get("nsfw", False, bool)
flag_private = request.values.get("private", False, bool)
flag_ghost = request.values.get("ghost", False, bool) and v.can_post_in_ghost_threads
@ -559,7 +559,7 @@ def submit_post(v, sub=None):
private=flag_private,
notify=flag_notify,
author_id=v.id,
over_18=flag_over_18,
nsfw=flag_nsfw,
new=flag_new,
app_id=v.client.application.id if v.client else None,
is_bot=(v.client is not None),
@ -661,7 +661,7 @@ def submit_post(v, sub=None):
c_jannied = Comment(author_id=AUTOJANNY_ID,
parent_post=p.id,
level=1,
over_18=False,
nsfw=False,
is_bot=True,
app_id=None,
distinguish_level=6,
@ -780,10 +780,10 @@ def mark_post_nsfw(pid, v):
if p.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION'] and not (p.sub and v.mods(p.sub)):
abort(403)
if p.over_18 and v.is_permabanned:
if p.nsfw and v.is_permabanned:
abort(403)
p.over_18 = True
p.nsfw = True
g.db.add(p)
if p.author_id != v.id:
@ -819,10 +819,10 @@ def unmark_post_nsfw(pid, v):
if p.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION'] and not (p.sub and v.mods(p.sub)):
abort(403)
if p.over_18 and v.is_permabanned:
if p.nsfw and v.is_permabanned:
abort(403)
p.over_18 = False
p.nsfw = False
g.db.add(p)
if p.author_id != v.id:

View File

@ -112,7 +112,7 @@ def searchposts(v):
) for x in criteria['q']]
posts = posts.filter(*words)
if 'nsfw' in criteria: posts = posts.filter(Post.over_18==True)
if 'nsfw' in criteria: posts = posts.filter(Post.nsfw==True)
if 'domain' in criteria:
domain = criteria['domain']
@ -236,7 +236,7 @@ def searchcomments(v):
' & '.join(tokens),
postgresql_regconfig='english'))
if 'nsfw' in criteria: comments = comments.filter(Comment.over_18 == True)
if 'nsfw' in criteria: comments = comments.filter(Comment.nsfw == True)
if search_operator_hole in criteria:
comments = comments.filter(Post.sub == criteria[search_operator_hole])

View File

@ -178,9 +178,9 @@ def settings_personal_post(v):
updated = True
session["cursormarsey"] = int(request.values.get("cursormarsey") == 'true')
elif not updated and request.values.get("over_18", v.over_18) != v.over_18:
elif not updated and request.values.get("nsfw", v.nsfw) != v.nsfw:
updated = True
session["over_18"] = int(request.values.get("over_18") == 'true')
session["nsfw"] = int(request.values.get("nsfw") == 'true')
elif not updated and IS_EVENT() and v.can_toggle_event_music and request.values.get("event_music", v.event_music) != v.event_music:
updated = True

View File

@ -42,11 +42,11 @@ def reddit_post(subreddit, v, path):
return redirect(f'https://{reddit}/{post_id}')
@cache.cached(make_cache_key=lambda kind, over_18:f"emoji_list_{kind}_{over_18}")
def get_emoji_list(kind, over_18):
@cache.cached(make_cache_key=lambda kind, nsfw:f"emoji_list_{kind}_{nsfw}")
def get_emoji_list(kind, nsfw):
li = g.db.query(Emoji, User).join(User, Emoji.author_id == User.id).filter(Emoji.submitter_id == None, Emoji.kind == kind)
if not over_18:
li = li.filter(Emoji.over_18 == False)
if not nsfw:
li = li.filter(Emoji.nsfw == False)
li = li.order_by(Emoji.count.desc())
emojis = []
@ -65,7 +65,7 @@ def marseys_redirect():
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def emoji_list(v, kind):
emojis = get_emoji_list(kind, g.show_over_18)
emojis = get_emoji_list(kind, g.show_nsfw)
authors = get_accounts_dict([e.author_id for e in emojis], v=v, graceful=True)
if FEATURES['ASSET_SUBMISSIONS']:
@ -86,12 +86,12 @@ def emoji_list(v, kind):
@cache.cached(make_cache_key=lambda over_18:f"emojis_{over_18}")
def get_emojis(over_18):
@cache.cached(make_cache_key=lambda nsfw:f"emojis_{nsfw}")
def get_emojis(nsfw):
emojis = g.db.query(Emoji, User).join(User, Emoji.author_id == User.id).filter(Emoji.submitter_id == None)
if not over_18:
emojis = emojis.filter(Emoji.over_18 == False)
if not nsfw:
emojis = emojis.filter(Emoji.nsfw == False)
emojis1 = emojis.filter(Emoji.kind != 'Marsey Alphabet').order_by(Emoji.count.desc()).all()
emojis2 = emojis.filter(Emoji.kind == 'Marsey Alphabet').order_by(func.length(Emoji.name), Emoji.name).all()
@ -111,7 +111,7 @@ def get_emojis(over_18):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def emojis(v):
return get_emojis(g.show_over_18)
return get_emojis(g.show_nsfw)

View File

@ -121,7 +121,7 @@ def get_logged_in_user():
if v and not IS_EVENT():
session.pop("event_music", None)
g.show_over_18 = SITE_NAME == 'WPD' or (v and v.over_18) or session.get('over_18_cookies', 0) >= int(time.time())
g.show_nsfw = SITE_NAME == 'WPD' or (v and v.nsfw) or session.get('nsfw_cookies', 0) >= int(time.time())
return v

View File

@ -30,7 +30,7 @@
<div id="comment-{{c.id}}-only" class="comment-{{c.id}}-only">
<div class="user-info">
<span class="comment-collapse-icon" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
{% if standalone and c.over_18 %}<span class="badge badge-danger">NSFW</span> {% endif %}
{% if standalone and c.nsfw %}<span class="badge badge-danger">NSFW</span> {% endif %}
{% if c.is_banned %}Removed by @{{c.ban_reason}} (Site Admin){% elif c.deleted_utc %}Deleted by author{% endif %}
</div>
</div>
@ -63,7 +63,7 @@
{% if standalone and level==1 %}
<div id="post-info-{{c.id}}" class="text-break post-info mb-1 mr-2 {% if request.path.startswith('/notifications') %}mt-5{% elif request.path == '/search/messages' %}mt-6{% else %}mt-3{% endif %}">
{% if c.parent_post and c.post.over_18 %}
{% if c.parent_post and c.post.nsfw %}
<span class="badge badge-danger text-small-extra mr-1">NSFW</span>
{% endif %}
<span class="align-top">
@ -139,7 +139,7 @@
{% endif %}
{% if c.active_reports(v) %}<button type="button" class="btn btn-primary mr-1" style="padding:1px 5px; font-size:10px" data-toggleelement="#reports-{{c.id}}" data-toggleattr="d-none">{{c.active_reports(v)}} Report{{macros.plural(c.active_reports(v))}}</button>{% endif %}
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">NSFW</span>{% endif %}
{% if c.nsfw %}<span class="badge badge-danger text-small-extra mr-1">NSFW</span>{% endif %}
{% if v and v.can_see_shadowbanned and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{c.author.shadowbanner}} for "{{c.author.ban_reason}}"' data-bs-html="true"></i>{% endif %}
{% if c.stickied %}
<i id='pinned-{{c.id}}'class="fas fa-thumbtack fa-rotate--45 pr-1 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{c.stickied}}" {% if c.stickied_utc %}data-onmouseover="pinned_timestamp('pinned-{{c.id}}')" data-timestamp={{c.stickied_utc}} data-nonce="{{g.nonce}}"{% endif %}></i>
@ -475,8 +475,8 @@
{% endif %}
{% if FEATURES['NSFW_MARKING'] and (c.parent_post or c.wall_user_id) and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.sub and v.mods(c.post.sub))) %}
<button type="button" id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.over_18 %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark NSFW</button>
<button type="button" id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.over_18 %}d-md-block{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-success fa-fw"></i>Unmark NSFW</button>
<button type="button" id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.nsfw %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark NSFW</button>
<button type="button" id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.nsfw %}d-md-block{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-success fa-fw"></i>Unmark NSFW</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
@ -629,9 +629,9 @@
{% endif %}
{% if FEATURES['NSFW_MARKING'] and (c.author_id == v.id or (c.post.sub and v.mods(c.post.sub))) %}
<button type="button" id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark NSFW</button>
<button type="button" id="mark2-{{c.id}}" class="{% if c.nsfw %}d-none{% endif %} list-group-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark NSFW</button>
<button type="button" id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-success mr-2"></i>Unmark NSFW</button>
<button type="button" id="unmark2-{{c.id}}" class="{% if not c.nsfw %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-success mr-2"></i>Unmark NSFW</button>
{% endif %}
{% if v.admin_level < PERMS['POST_COMMENT_MODERATION'] %}
@ -695,8 +695,8 @@
<button type="button" id="unpin2-{{c.id}}" class="list-group-item {% if not c.stickied %}d-none{% endif %} text-info" data-bs-target="#adminModal-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unsticky_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</button>
{% if FEATURES['NSFW_MARKING'] %}
<button type="button" id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark NSFW</button>
<button type="button" id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-success mr-2"></i>Unmark NSFW</button>
<button type="button" id="mark2-{{c.id}}" class="{% if c.nsfw %}d-none{% endif %} list-group-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark NSFW</button>
<button type="button" id="unmark2-{{c.id}}" class="{% if not c.nsfw %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-success mr-2"></i>Unmark NSFW</button>
{% endif %}
{% endif %}

View File

@ -14,7 +14,7 @@
<input type="submit" class="btn btn-danger" value="Yes">
</form>
<div class="mt-3"><a href="/" class="btn btn-secondary">No</a></div>
<div class="mt-5"><a href="/settings/advanced#over_18_toggle" class="btn btn-secondary">Never show me this warning again</a></div>
<div class="mt-5"><a href="/settings/advanced#nsfw_toggle" class="btn btn-secondary">Never show me this warning again</a></div>
</div>
</div>
</div>

View File

@ -75,8 +75,8 @@
{% endif %}
{% endif %}
{% if FEATURES['NSFW_MARKING'] and (v.id==p.author_id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (p.sub and v.mods(p.sub))) %}
<button type="button" id="mark-{{p.id}}" class="dropdown-item {% if p.over_18 %}d-none{% endif %} list-inline-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mark_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}','d-none')"><i class="fas fa-eye-evil"></i>Mark NSFW</button>
<button type="button" id="unmark-{{p.id}}" class="dropdown-item {% if not p.over_18 %}d-none{% endif %} list-inline-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmark_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}','d-none')"><i class="fas fa-eye-evil"></i>Unmark NSFW</button>
<button type="button" id="mark-{{p.id}}" class="dropdown-item {% if p.nsfw %}d-none{% endif %} list-inline-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mark_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}','d-none')"><i class="fas fa-eye-evil"></i>Mark NSFW</button>
<button type="button" id="unmark-{{p.id}}" class="dropdown-item {% if not p.nsfw %}d-none{% endif %} list-inline-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmark_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}','d-none')"><i class="fas fa-eye-evil"></i>Unmark NSFW</button>
{% endif %}
{% if v.admin_level >= PERMS['PROGSTACK'] %}
<button type="button" id="progstack-{{p.id}}" class="dropdown-item {% if p.is_approved == PROGSTACK_ID %}d-none{% endif %} list-inline-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/progstack/post/{{p.id}}','progstack-{{p.id}}','unprogstack-{{p.id}}','d-none')"><i class="fas fa-bullhorn"></i>Apply Progressive Stack</button>

View File

@ -51,8 +51,8 @@
{% endif %}
{% if FEATURES['NSFW_MARKING'] and (v.id==p.author_id or (p.sub and v.mods(p.sub))) %}
<button type="button" id="mark3-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mark_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center mr-2"></i>Mark NSFW</button>
<button type="button" id="unmark3-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmark_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center mr-2"></i>Unmark NSFW</button>
<button type="button" id="mark3-{{p.id}}" class="{% if p.nsfw %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mark_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center mr-2"></i>Mark NSFW</button>
<button type="button" id="unmark3-{{p.id}}" class="{% if not p.nsfw %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmark_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center mr-2"></i>Unmark NSFW</button>
{% endif %}
{% if p.sub and v.mods(p.sub) %}

View File

@ -34,8 +34,8 @@
<button type="button" id="approve2-{{p.id}}" class="{% if not p.is_banned and request.path != '/admin/reported/posts' %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="approvePost(this,'{{p.id}}','remove2-{{p.id}}','approve2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-check text-center mr-2"></i>Approve</button>
{% endif %}
{% if FEATURES['NSFW_MARKING'] and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
<button type="button" id="mark2-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mark_post_nsfw/{{p.id}}','mark2-{{p.id}}','unmark2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center text-danger mr-2"></i>Mark NSFW</button>
<button type="button" id="unmark2-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmark_post_nsfw/{{p.id}}','mark2-{{p.id}}','unmark2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center text-success mr-2"></i>Unmark NSFW</button>
<button type="button" id="mark2-{{p.id}}" class="{% if p.nsfw %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mark_post_nsfw/{{p.id}}','mark2-{{p.id}}','unmark2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center text-danger mr-2"></i>Mark NSFW</button>
<button type="button" id="unmark2-{{p.id}}" class="{% if not p.nsfw %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmark_post_nsfw/{{p.id}}','mark2-{{p.id}}','unmark2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-center text-success mr-2"></i>Unmark NSFW</button>
{% endif %}
{% if v.admin_level >= PERMS['PROGSTACK'] %}
<button type="button" id="progstack2-{{p.id}}" class="{% if p.is_approved == PROGSTACK_ID %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/progstack/post/{{p.id}}','progstack2-{{p.id}}','unprogstack2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-bullhorn text-center text-danger mr-2"></i>Apply Progressive Stack</button>

View File

@ -23,9 +23,9 @@
<div class="col-12">
<div id="post-{{p.id}}" class="banned {% if p.award_count('glowie', v) %}glow{% endif %} card d-flex flex-row-reverse flex-nowrap justify-content-end border-0 p-0 {% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}">
<div class="card-block my-md-auto">
<div class="post-meta text-left d-md-none mb-1">{% if p.over_18 %}<span class="badge badge-danger">NSFW</span> {% endif %}{% if p.is_banned %}Removed by @{{p.ban_reason}} (Site Admin){% else %}[Deleted by user]{% endif %}</div>
<div class="post-meta text-left d-md-none mb-1">{% if p.nsfw %}<span class="badge badge-danger">NSFW</span> {% endif %}{% if p.is_banned %}Removed by @{{p.ban_reason}} (Site Admin){% else %}[Deleted by user]{% endif %}</div>
<h5 class="card-title post-title text-left mb-0 mb-md-1">{{p.plaintitle(v)}}</h5>
<div class="post-meta text-left d-mob-none">{% if p.over_18 %}<span class="badge badge-danger">NSFW</span> {% endif %}{% if p.is_banned %}Removed by @{{p.ban_reason}} (Site Admin){% else %}[Deleted by user]{% endif %}</div>
<div class="post-meta text-left d-mob-none">{% if p.nsfw %}<span class="badge badge-danger">NSFW</span> {% endif %}{% if p.is_banned %}Removed by @{{p.ban_reason}} (Site Admin){% else %}[Deleted by user]{% endif %}</div>
</div>
<div id="voting" class="d-md-block my-auto mr-3 text-center">
<div class="post-{{p.id}}-up arrow-up mx-auto">

View File

@ -28,7 +28,7 @@
{{macros.reports(p, 'post')}}
<div id="post-{{p.id}}" class="actual-post card {% if p.ghost %}ghost-post{% endif %} {% if p.unread %}unread{% endif %} {% if p.is_banned %} banned{% endif %}{% if p.deleted_utc %} deleted{% endif %}{% if p.stickied %} stickied{% endif %}{% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}{% if p.over_18 %} nsfw{% endif %}">
<div id="post-{{p.id}}" class="actual-post card {% if p.ghost %}ghost-post{% endif %} {% if p.unread %}unread{% endif %} {% if p.is_banned %} banned{% endif %}{% if p.deleted_utc %} deleted{% endif %}{% if p.stickied %} stickied{% endif %}{% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}{% if p.nsfw %} nsfw{% endif %}">
<div class="d-flex flex-row-reverse flex-md-row flex-nowrap" style="align-items:flex-start">
<div class="voting my-2 d-none d-md-flex pr-2">

View File

@ -130,7 +130,7 @@
<div class="settings-section rounded">
{{common.toggle_section('Disable Signatures', 'sigs_disabled', 'sigs_disabled', v.sigs_disabled, 'Hide user signatures.', false)}}
{% if FEATURES['NSFW_MARKING'] %}
{{common.toggle_section('Disable NSFW Warnings', 'over_18', 'over_18', v.over_18, "Disable the warning that appears when viewing NSFW posts and stop collapsing NSFW comments.", false)}}
{{common.toggle_section('Disable NSFW Warnings', 'nsfw', 'nsfw', v.nsfw, "Disable the warning that appears when viewing NSFW posts and stop collapsing NSFW comments.", false)}}
{% endif %}
{% if SITE_NAME != 'rDrama' %}
{{common.toggle_section('Hide Posts Voted On', 'hidevotedon', 'hidevotedon', v.hidevotedon, 'Enable if you would like to automatically hide posts you have voted on from your frontpage.', false)}}

View File

@ -69,7 +69,7 @@
</div>
{% if FEATURES['NSFW_MARKING'] %}
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="post-nsfw" name="over_18" data-nonce="{{g.nonce}}" data-onchange="savetext()">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="post-nsfw" name="nsfw" data-nonce="{{g.nonce}}" data-onchange="savetext()">
<label class="custom-control-label" for="post-nsfw">NSFW</label>
</div>
{% endif %}

View File

@ -45,7 +45,7 @@
{% if FEATURES['NSFW_MARKING'] %}
<div class="custom-control custom-checkbox mt-4">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="emoji-nsfw" name="over_18">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="emoji-nsfw" name="nsfw">
<label class="custom-control-label" for="emoji-nsfw">NSFW</label>
</div>
{% endif %}
@ -101,7 +101,7 @@
{% if FEATURES['NSFW_MARKING'] %}
<div class="custom-control custom-checkbox mt-4">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="{{emoji.name}}-nsfw" name="over_18" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %} {% if emoji.over_18 %}checked{% endif %}>
<input autocomplete="off" type="checkbox" class="custom-control-input" id="{{emoji.name}}-nsfw" name="nsfw" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %} {% if emoji.nsfw %}checked{% endif %}>
<label class="custom-control-label" for="{{emoji.name}}-nsfw">NSFW</label>
</div>
{% endif %}

View File

@ -53,7 +53,7 @@
{% if p.is_pinned and request.path != '/' %}
<i class="fas fa-thumbtack fa-rotate--45 pr-1 ml-1 mt-3 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned to profile"></i>
{% endif %}
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">NSFW</span>{% endif %}
{% if p.nsfw %}<span class="badge badge-danger text-small-extra mr-1">NSFW</span>{% endif %}
{% if p.is_bot %} <i class="fas fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Bot"></i>{% endif %}
{% if p.is_blocking and not p.ghost %}<i class="fas fa-user-minus text-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="You're blocking this user."></i>{% endif %}
{% if p.is_blocked and not p.ghost %}<i class="fas fa-user-minus text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="This user is blocking you."></i>{% endif %}

View File

@ -0,0 +1,3 @@
alter table comments rename column over_18 to nsfw;
alter table emojis rename column over_18 to nsfw;
alter table posts rename column over_18 to nsfw;