forked from rDrama/rDrama
apply slur filter to hat descriptions
parent
256b384e69
commit
5feb479cd2
|
@ -2,6 +2,7 @@ from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
from files.helpers.lazy import lazy
|
from files.helpers.lazy import lazy
|
||||||
|
from files.helpers.regex import censor_slurs
|
||||||
from flask import g
|
from flask import g
|
||||||
|
|
||||||
class HatDef(Base):
|
class HatDef(Base):
|
||||||
|
@ -20,6 +21,10 @@ class HatDef(Base):
|
||||||
def number_sold(self):
|
def number_sold(self):
|
||||||
return g.db.query(Hat).filter_by(hat_id=self.id).count()
|
return g.db.query(Hat).filter_by(hat_id=self.id).count()
|
||||||
|
|
||||||
|
@lazy
|
||||||
|
def censored_description(self, v):
|
||||||
|
return censor_slurs(self.description, v)
|
||||||
|
|
||||||
class Hat(Base):
|
class Hat(Base):
|
||||||
__tablename__ = "hats"
|
__tablename__ = "hats"
|
||||||
|
|
||||||
|
|
|
@ -665,9 +665,8 @@ class User(Base):
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@property
|
|
||||||
@lazy
|
@lazy
|
||||||
def hat_tooltip(self):
|
def hat_tooltip(v, self):
|
||||||
if not FEATURES['HATS']:
|
if not FEATURES['HATS']:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -675,7 +674,7 @@ class User(Base):
|
||||||
return "I've spent another year rotting my brain with dramaposting, please ridicule me 🤓"
|
return "I've spent another year rotting my brain with dramaposting, please ridicule me 🤓"
|
||||||
|
|
||||||
if self.equipped_hat_id:
|
if self.equipped_hat_id:
|
||||||
return self.equipped_hat.description
|
return self.equipped_hat.censored_description(v)
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
<div class="profile-pic-30-wrapper">
|
<div class="profile-pic-30-wrapper">
|
||||||
<img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-30 mr-2">
|
<img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-30 mr-2">
|
||||||
{% if c.author.hat_active -%}
|
{% if c.author.hat_active -%}
|
||||||
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{c.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{c.author.hat_tooltip}}">
|
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{c.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{c.author.hat_tooltip(v)}}">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</div>
|
</div>
|
||||||
<span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.name_color}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span>
|
<span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.name_color}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=1"></td>
|
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=1"></td>
|
||||||
<td>{{hat.name}}</td>
|
<td>{{hat.name}}</td>
|
||||||
<td>{{hat.description}}</td>
|
<td>{{hat.censored_description(v)}}</td>
|
||||||
{% if SITE == 'rdrama.net' %}
|
{% if SITE == 'rdrama.net' %}
|
||||||
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
|
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=1"></td>
|
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=1"></td>
|
||||||
<td>{{hat.name}}</td>
|
<td>{{hat.name}}</td>
|
||||||
<td>{{hat.description}}</td>
|
<td>{{hat.censored_description(v)}}</td>
|
||||||
{% if SITE == 'rdrama.net' %}
|
{% if SITE == 'rdrama.net' %}
|
||||||
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
|
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
<div class="profile-pic-35-wrapper">
|
<div class="profile-pic-35-wrapper">
|
||||||
<img loading="lazy" src="{{v.profile_url}}" class="profile-pic-35">
|
<img loading="lazy" src="{{v.profile_url}}" class="profile-pic-35">
|
||||||
{% if v.hat_active -%}
|
{% if v.hat_active -%}
|
||||||
<img class="profile-pic-35-hat hat" loading="lazy" src="/i/hats/{{v.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{v.hat_tooltip}}">
|
<img class="profile-pic-35-hat hat" loading="lazy" src="/i/hats/{{v.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{v.hat_tooltip(v)}}">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-left pl-2">
|
<div class="text-left pl-2">
|
||||||
|
|
|
@ -677,7 +677,7 @@
|
||||||
<div class="profile-pic-30-wrapper">
|
<div class="profile-pic-30-wrapper">
|
||||||
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
|
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
|
||||||
{% if p.author.hat_active -%}
|
{% if p.author.hat_active -%}
|
||||||
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip}}">
|
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</div>
|
</div>
|
||||||
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
||||||
|
|
|
@ -213,7 +213,7 @@
|
||||||
<div class="profile-pic-30-wrapper">
|
<div class="profile-pic-30-wrapper">
|
||||||
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
|
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
|
||||||
{% if p.author.hat_active -%}
|
{% if p.author.hat_active -%}
|
||||||
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip}}">
|
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</div>
|
</div>
|
||||||
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-100-wrapper">
|
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-100-wrapper">
|
||||||
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic profile-pic-100 mb-5">
|
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic profile-pic-100 mb-5">
|
||||||
{% if u.hat_active -%}
|
{% if u.hat_active -%}
|
||||||
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-100-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip}}">
|
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-100-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-65-wrapper">
|
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-65-wrapper">
|
||||||
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic-65 bg-white border-2 border-white mb-2">
|
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic-65 bg-white border-2 border-white mb-2">
|
||||||
{% if u.hat_active -%}
|
{% if u.hat_active -%}
|
||||||
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-65-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip}}">
|
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-65-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue