fds
This commit is contained in:
parent
a013320f07
commit
914aa68d8e
11 changed files with 15 additions and 22 deletions
|
@ -108,7 +108,6 @@ class User(Base):
|
||||||
is_banned = Column(Integer, default=0)
|
is_banned = Column(Integer, default=0)
|
||||||
unban_utc = Column(Integer, default=0)
|
unban_utc = Column(Integer, default=0)
|
||||||
ban_reason = deferred(Column(String))
|
ban_reason = deferred(Column(String))
|
||||||
club_banned = Column(Boolean, default=False)
|
|
||||||
club_allowed = Column(Boolean, default=False)
|
club_allowed = Column(Boolean, default=False)
|
||||||
login_nonce = Column(Integer, default=0)
|
login_nonce = Column(Integer, default=0)
|
||||||
reserved = deferred(Column(String))
|
reserved = deferred(Column(String))
|
||||||
|
@ -188,7 +187,7 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def paid_dues(self):
|
def paid_dues(self):
|
||||||
return self.admin_level > 1 or self.club_allowed or (self.truecoins > int(environ.get("DUES").strip()) and not self.club_banned)
|
return self.admin_level > 1 or self.club_allowed or self.truecoins > int(environ.get("DUES").strip()) and self.club_allowed != False
|
||||||
|
|
||||||
def any_block_exists(self, other):
|
def any_block_exists(self, other):
|
||||||
|
|
||||||
|
|
|
@ -112,12 +112,10 @@ def club_allow(v, username):
|
||||||
if u.admin_level >= v.admin_level: return {"error": "noob"}
|
if u.admin_level >= v.admin_level: return {"error": "noob"}
|
||||||
|
|
||||||
u.club_allowed = True
|
u.club_allowed = True
|
||||||
u.club_banned = False
|
|
||||||
g.db.add(u)
|
g.db.add(u)
|
||||||
|
|
||||||
for x in u.alts_unique:
|
for x in u.alts_unique:
|
||||||
x.club_allowed = True
|
x.club_allowed = True
|
||||||
x.club_banned = False
|
|
||||||
g.db.add(x)
|
g.db.add(x)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
@ -135,11 +133,9 @@ def club_ban(v, username):
|
||||||
|
|
||||||
if u.admin_level >= v.admin_level: return {"error": "noob"}
|
if u.admin_level >= v.admin_level: return {"error": "noob"}
|
||||||
|
|
||||||
u.club_banned = True
|
|
||||||
u.club_allowed = False
|
u.club_allowed = False
|
||||||
|
|
||||||
for x in u.alts_unique:
|
for x in u.alts_unique:
|
||||||
x.club_banned = True
|
|
||||||
u.club_allowed = False
|
u.club_allowed = False
|
||||||
g.db.add(x)
|
g.db.add(x)
|
||||||
|
|
||||||
|
|
|
@ -327,8 +327,7 @@ def sign_up_post(v):
|
||||||
created_utc=int(time.time()),
|
created_utc=int(time.time()),
|
||||||
referred_by=ref_id or None,
|
referred_by=ref_id or None,
|
||||||
ban_evade = int(any([(x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x])),
|
ban_evade = int(any([(x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x])),
|
||||||
agendaposter = any([x.agendaposter for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x]),
|
agendaposter = any([x.agendaposter for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x])
|
||||||
club_banned=any([x.club_banned for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
g.db.add(new_user)
|
g.db.add(new_user)
|
||||||
|
|
|
@ -33,7 +33,7 @@ if path.exists(f'snappy_{site_name}.txt'):
|
||||||
@auth_required
|
@auth_required
|
||||||
def toggle_club(pid, v):
|
def toggle_club(pid, v):
|
||||||
|
|
||||||
if v.club_banned: abort(403)
|
if v.club_allowed == False: abort(403)
|
||||||
post = get_post(pid)
|
post = get_post(pid)
|
||||||
if post.author_id != v.id and v.admin_level == 0: abort(403)
|
if post.author_id != v.id and v.admin_level == 0: abort(403)
|
||||||
|
|
||||||
|
@ -982,8 +982,8 @@ def submit_post(v):
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403
|
return render_template(f"{template}submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403
|
||||||
|
|
||||||
if not v.club_banned: club = bool(request.values.get("club",""))
|
if v.club_allowed == False: club = False
|
||||||
else: club = False
|
else: club = bool(request.values.get("club",""))
|
||||||
|
|
||||||
if embed and len(embed) > 1500: embed = None
|
if embed and len(embed) > 1500: embed = None
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<a rel="nofollow noopener noreferrer" href="{% if 'rama' in request.host %}https://secure.transequality.org/site/Donation2?df_id=1480{% else %}/{% endif %}">
|
<a rel="nofollow noopener noreferrer" href="{% if 'rama' in request.host %}https://secure.transequality.org/site/Donation2?df_id=1480{% else %}/{% endif %}">
|
||||||
<img class="banner" src="/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.webp{% else %}cached.webp{% endif %}?v=190" width="100%">
|
<img class="banner" alt="banner" src="/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.webp{% else %}cached.webp{% endif %}?v=190" width="100%">
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="modal-body text-center p-0">
|
<div class="modal-body text-center p-0">
|
||||||
<div class="d-inline-block position-relative">
|
<div class="d-inline-block position-relative">
|
||||||
<a href="" rel="nofollow noopener noreferrer" target="_blank" id="desktop-expanded-image-wrap-link">
|
<a href="" rel="nofollow noopener noreferrer" target="_blank" id="desktop-expanded-image-wrap-link">
|
||||||
<img loading="lazy" src="" class="img-fluid rounded" id="desktop-expanded-image" style="min-width: 250px;">
|
<img loading="lazy" alt="expanded image" src="" class="img-fluid rounded" id="desktop-expanded-image" style="min-width: 250px;">
|
||||||
</a>
|
</a>
|
||||||
<div class="position-absolute d-flex justify-content-between align-items-center w-100 mt-1">
|
<div class="position-absolute d-flex justify-content-between align-items-center w-100 mt-1">
|
||||||
<a href="" rel="nofollow noopener noreferrer" target="_blank" class="text-gray-500 font-weight-bold text-left" id="desktop-expanded-image-link">View original</a>
|
<a href="" rel="nofollow noopener noreferrer" target="_blank" class="text-gray-500 font-weight-bold text-left" id="desktop-expanded-image-link">View original</a>
|
||||||
|
|
|
@ -213,7 +213,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if not v.club_banned %}
|
{% if v.club_allowed != False %}
|
||||||
<button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
|
<button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
|
||||||
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
|
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -552,7 +552,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
{% if v.admin_level > 1 or v.id == p.author.id and not v.club_banned %}
|
{% if v.admin_level > 1 or v.id == p.author.id and v.club_allowed != False %}
|
||||||
<a id="club-{{p.id}}" class="{% if p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye-slash"></i>Mark club</a>
|
<a id="club-{{p.id}}" class="{% if p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye-slash"></i>Mark club</a>
|
||||||
<a id="unclub-{{p.id}}" class="{% if not p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye"></i>Unmark club</a>
|
<a id="unclub-{{p.id}}" class="{% if not p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye"></i>Unmark club</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -250,7 +250,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
{% if v.admin_level > 1 or v.id == p.author.id and not v.club_banned %}
|
{% if v.admin_level > 1 or v.id == p.author.id and v.club_allowed != False %}
|
||||||
<a id="club-{{p.id}}" class="{% if p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye-slash"></i>Mark club</a>
|
<a id="club-{{p.id}}" class="{% if p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye-slash"></i>Mark club</a>
|
||||||
<a id="unclub-{{p.id}}" class="{% if not p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye"></i>Unmark club</a>
|
<a id="unclub-{{p.id}}" class="{% if not p.club %}d-none{% endif %} list-inline-item text-info" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye"></i>Unmark club</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -412,7 +412,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if not v.club_banned %}
|
{% if v.club_allowed != False %}
|
||||||
<button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
|
<button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
|
||||||
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
|
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
<label class="custom-control-label" for="privateCheck">Draft</label>
|
<label class="custom-control-label" for="privateCheck">Draft</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not v.club_banned %}
|
{% if v.club_allowed != False %}
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="clubCheck" name="club">
|
<input type="checkbox" class="custom-control-input" id="clubCheck" name="club">
|
||||||
<label class="custom-control-label" for="clubCheck">{{cc}} thread</label>
|
<label class="custom-control-label" for="clubCheck">{{cc}} thread</label>
|
||||||
|
|
|
@ -289,7 +289,7 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<button id="grant2" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast2('/@{{u.username}}/club_allow','grant2','bar2')">Grant club access</button>
|
<button id="grant2" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast2('/@{{u.username}}/club_allow','grant2','bar2')">Grant club access</button>
|
||||||
<button id="bar2" class="{% if u.club_banned %}d-none{% endif %} btn btn-danger" onclick="post_toast2('/@{{u.username}}/club_ban','grant2','bar2')">Bar from club</button>
|
<button id="bar2" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="post_toast2('/@{{u.username}}/club_ban','grant2','bar2')">Bar from club</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
<p>User ID: {{u.id}}</p>
|
<p>User ID: {{u.id}}</p>
|
||||||
|
@ -483,7 +483,7 @@
|
||||||
{% if v.admin_level > 1 %}
|
{% if v.admin_level > 1 %}
|
||||||
|
|
||||||
<button id="grant" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast2('/@{{u.username}}/club_allow','grant','bar')">Grant club access</button>
|
<button id="grant" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast2('/@{{u.username}}/club_allow','grant','bar')">Grant club access</button>
|
||||||
<button id="bar" class="{% if u.club_banned %}d-none{% endif %} btn btn-danger" onclick="post_toast2('/@{{u.username}}/club_ban','grant','bar')">Bar from club</button>
|
<button id="bar" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="post_toast2('/@{{u.username}}/club_ban','grant','bar')">Bar from club</button>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<div class="body d-lg-flex border-bottom">
|
<div class="body d-lg-flex border-bottom">
|
||||||
|
|
|
@ -733,7 +733,6 @@ CREATE TABLE public.users (
|
||||||
cardview boolean,
|
cardview boolean,
|
||||||
received_award_count integer,
|
received_award_count integer,
|
||||||
highlightcomments boolean,
|
highlightcomments boolean,
|
||||||
club_banned boolean DEFAULT false,
|
|
||||||
nitter boolean,
|
nitter boolean,
|
||||||
truecoins integer,
|
truecoins integer,
|
||||||
club_allowed boolean DEFAULT false,
|
club_allowed boolean DEFAULT false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue