fix banning/chudding ppl with early life award via modal

pull/222/head
Aevann 2024-02-11 12:48:11 +02:00
parent 0b6a3e4e86
commit 9b62698cf4
5 changed files with 20 additions and 8 deletions

View File

@ -326,6 +326,12 @@ class Comment(Base):
if self.ghost and not (hasattr(g, 'v') and g.v and self.id == g.v.id): return '👻'
return self.author.user_name
@property
@lazy
def author_name_punish_modal(self):
if self.ghost and not (hasattr(g, 'v') and g.v and self.id == g.v.id): return '👻'
return self.author.username
@lazy
def award_count(self, kind, v):
if v and v.poor:

View File

@ -160,6 +160,12 @@ class Post(Base):
if self.ghost and not (hasattr(g, 'v') and g.v and self.id == g.v.id): return '👻'
return self.author.user_name
@property
@lazy
def author_name_punish_modal(self):
if self.ghost and not (hasattr(g, 'v') and g.v and self.id == g.v.id): return '👻'
return self.author.username
@property
@lazy
def is_youtube(self):

View File

@ -482,13 +482,13 @@
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
<button type="button" class="{% if c.author.is_permabanned %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
<button type="button" class="{% if c.author.is_permabanned %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
<button type="button" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.is_suspended %}d-none{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != c.author_id %}
<button type="button" class="{% if c.author.chud == 1 %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
<button type="button" class="{% if c.author.chud == 1 %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
<button type="button" id="unchud-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.chud %}d-none{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{c.fullname}}')"><i class="fas fa-face-sleeping text-success fa-fw"></i>Unchud user</button>
{% endif %}
@ -707,12 +707,12 @@
{% endif %}
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %}
<button type="button" class="list-group-item text-danger {% if c.author.is_permabanned %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
<button type="button" class="list-group-item text-danger {% if c.author.is_permabanned %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
<button type="button" id="unban2-{{c.fullname}}" class="{% if not c.author.is_suspended %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</button>
{% endif %}
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
<button type="button" class="list-group-item text-danger {% if c.author.chud == 1 %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw mr-2"></i>Chud user</button>
<button type="button" class="list-group-item text-danger {% if c.author.chud == 1 %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw mr-2"></i>Chud user</button>
<button type="button" id="unchud2-{{c.fullname}}" class="{% if not c.author.chud %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{c.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-face-sleeping fa-fw text-success mr-2"></i>Unchud user</button>
{% endif %}

View File

@ -92,12 +92,12 @@
<button type="button" id="unprogstack-{{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/unprogstack/post/{{p.id}}','progstack-{{p.id}}','unprogstack-{{p.id}}','d-none')"><i class="fas fa-bullhorn"></i>Remove Progressive Stack</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %}
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.is_permabanned %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.is_permabanned %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item list-inline-item text-success {% if not p.author.is_suspended %}d-none{% endif %}" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')"><i class="fas fa-user-slash"></i>Unban user</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != p.author_id %}
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.chud == 1 %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.chud == 1 %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
<button type="button" id="unchud-{{p.fullname}}" class="dropdown-item {% if not p.author.chud %}d-none{% endif %} list-inline-item text-success" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{p.fullname}}')"><i class="fas fa-face-sleeping"></i>Unchud user</button>
{% endif %}

View File

@ -46,12 +46,12 @@
<button type="button" id="unprogstack2-{{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/unprogstack/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>Remove Progressive Stack</button>
{% endif %}
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %}
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.is_permabanned %}d-none{% endif %}"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.is_permabanned %}d-none{% endif %}"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
<button type="button" id="unban2-{{p.fullname}}" class="{% if not p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-2"></i>Unban user</button>
{% endif %}
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.chud == 1 %}d-none{% endif %}"><i class="fas fa-face-sleeping mr-2"></i>Chud user</button>
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.chud == 1 %}d-none{% endif %}"><i class="fas fa-face-sleeping mr-2"></i>Chud user</button>
<button type="button" id="unchud2-{{p.fullname}}" class="{% if not p.author.chud %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-face-sleeping mr-2"></i>Unchud user</button>
{% endif %}