minor bugfix
parent
f551c8e018
commit
36fca9caab
|
@ -81,7 +81,7 @@ class User(Base):
|
||||||
lootboxes_bought = Column(Integer, default=0)
|
lootboxes_bought = Column(Integer, default=0)
|
||||||
agendaposter = Column(Integer, default=0)
|
agendaposter = Column(Integer, default=0)
|
||||||
is_activated = Column(Boolean, default=False)
|
is_activated = Column(Boolean, default=False)
|
||||||
shadowbanned = Column(String)
|
shadowbanned = Column(Integer)
|
||||||
over_18 = Column(Boolean, default=False)
|
over_18 = Column(Boolean, default=False)
|
||||||
hidevotedon = Column(Boolean, default=False)
|
hidevotedon = Column(Boolean, default=False)
|
||||||
highlightcomments = Column(Boolean, default=True)
|
highlightcomments = Column(Boolean, default=True)
|
||||||
|
@ -1117,3 +1117,8 @@ class User(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def offsitementions(self):
|
def offsitementions(self):
|
||||||
return self.has_badge(140)
|
return self.has_badge(140)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def shadowbanner(self):
|
||||||
|
return g.db.query(User.username).filter_by(id=self.shadowbanned).one()
|
||||||
|
|
|
@ -385,7 +385,7 @@ def execute_blackjack(v, target, body, type):
|
||||||
if not execute_blackjack_custom(v, target, body, type): return False
|
if not execute_blackjack_custom(v, target, body, type): return False
|
||||||
if not blackjack or not body: return True
|
if not blackjack or not body: return True
|
||||||
if any(i in body.lower() for i in blackjack.split()):
|
if any(i in body.lower() for i in blackjack.split()):
|
||||||
v.shadowbanned = 'AutoJanny'
|
v.shadowbanned = AUTOJANNY_ID
|
||||||
if not v.is_banned: v.ban_reason = f"Blackjack"
|
if not v.is_banned: v.ban_reason = f"Blackjack"
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
notif = None
|
notif = None
|
||||||
|
@ -468,7 +468,7 @@ def execute_antispam_comment_check(body:str, v:User):
|
||||||
def execute_under_siege(v:User, target:Optional[Union[Submission, Comment]], body, type:str):
|
def execute_under_siege(v:User, target:Optional[Union[Submission, Comment]], body, type:str):
|
||||||
if not get_setting("under_siege"): return True
|
if not get_setting("under_siege"): return True
|
||||||
if v.age < UNDER_SIEGE_AGE_THRESHOLD and not v.admin_level >= PERMS['SITE_BYPASS_UNDER_SIEGE_MODE']:
|
if v.age < UNDER_SIEGE_AGE_THRESHOLD and not v.admin_level >= PERMS['SITE_BYPASS_UNDER_SIEGE_MODE']:
|
||||||
v.shadowbanned = 'AutoJanny'
|
v.shadowbanned = AUTOJANNY_ID
|
||||||
if not v.is_banned: v.ban_reason = f"Under Siege"
|
if not v.is_banned: v.ban_reason = f"Under Siege"
|
||||||
v.is_muted = True
|
v.is_muted = True
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
|
@ -889,7 +889,7 @@ def shadowban(user_id, v):
|
||||||
user = get_account(user_id)
|
user = get_account(user_id)
|
||||||
if user.admin_level > v.admin_level:
|
if user.admin_level > v.admin_level:
|
||||||
abort(403)
|
abort(403)
|
||||||
user.shadowbanned = v.username
|
user.shadowbanned = v.id
|
||||||
reason = request.values.get("reason").strip()[:256]
|
reason = request.values.get("reason").strip()[:256]
|
||||||
user.ban_reason = reason
|
user.ban_reason = reason
|
||||||
g.db.add(user)
|
g.db.add(user)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<td data-sort-key="{{user.username.lower() if user else ''}}">{%- include 'user_in_table.html' -%}</td>
|
<td data-sort-key="{{user.username.lower() if user else ''}}">{%- include 'user_in_table.html' -%}</td>
|
||||||
<td {% if user.last_active %}data-time="{{user.last_active}}"{% endif %}></td>
|
<td {% if user.last_active %}data-time="{{user.last_active}}"{% endif %}></td>
|
||||||
<td>{{user.truescore}}</td>
|
<td>{{user.truescore}}</td>
|
||||||
<td>{{user.shadowbanned}}</td>
|
<td><a href="/@{{user.shadowbanner}}">{{user.shadowbanner}}</a></td>
|
||||||
<td>{% if user.ban_reason %}{{user.ban_reason}}{% endif %}</td>
|
<td>{% if user.ban_reason %}{{user.ban_reason}}{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] and user.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{user.shadowbanned}}{% if user.ban_reason %} for "{{user.ban_reason}}"{% endif %}'></i>{% endif %}
|
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] and user.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{user.shadowbanner}}{% if user.ban_reason %} for "{{user.ban_reason}}"{% endif %}'></i>{% endif %}
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
|
|
||||||
{% if c.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags(v)}} Report{{macros.plural(c.active_flags(v))}}</button>{% endif %}
|
{% if c.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags(v)}} Report{{macros.plural(c.active_flags(v))}}</button>{% endif %}
|
||||||
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||||
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] 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.shadowbanned}} for "{{c.author.ban_reason}}"'></i>{% endif %}
|
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] 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}}"'></i>{% endif %}
|
||||||
{% if c.stickied %}
|
{% if c.stickied %}
|
||||||
<i id='pinned-{{c.id}}'class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{c.stickied}}" {% if c.stickied_utc %}onmouseover="pinned_timestamp('pinned-{{c.id}}')" data-timestamp={{c.stickied_utc}} {% endif %}></i>
|
<i id='pinned-{{c.id}}'class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{c.stickied}}" {% if c.stickied_utc %}onmouseover="pinned_timestamp('pinned-{{c.id}}')" data-timestamp={{c.stickied_utc}} {% endif %}></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
{% if u.ban_reason %}:
|
{% if u.ban_reason %}:
|
||||||
{{u.ban_reason | safe}}
|
{{u.ban_reason | safe}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
(by <a href="/@{{u.shadowbanned}}">@{{u.shadowbanned}}</a>)
|
(by <a href="/@{{u.shadowbanner}}">@{{u.shadowbanner}}</a>)
|
||||||
</h5>
|
</h5>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] and p.author.shadowbanned %}
|
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] and p.author.shadowbanned %}
|
||||||
<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{p.author.shadowbanned}} for "{{p.author.ban_reason}}"'></i>
|
<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{p.author.shadowbanner}} for "{{p.author.ban_reason}}"'></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if p.stickied %}
|
{% if p.stickied %}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
alter table users alter column shadowbanned type int using shadowbanned::integer;
|
||||||
|
create index fki_user_shadowbanned_fkey on public.users using btree (shadowbanned);
|
||||||
|
alter table only public.users add constraint user_shadowbanned_fkey foreign key (shadowbanned) references public.users(id);
|
Loading…
Reference in New Issue