master
Aevann1 2021-07-23 16:08:49 +02:00
parent 0a38d56242
commit 1ecfbf83b1
2 changed files with 6 additions and 19 deletions

View File

@ -31,6 +31,7 @@ class User(Base, Stndrd, Age_times):
song = Column(String, default=None)
profileurl = Column(String, default=None)
bannerurl = Column(String, default=None)
patron = Column(Bool, default=False)
email = Column(String, default=None)
css = deferred(Column(String, default=None))
profilecss = deferred(Column(String, default=None))
@ -360,12 +361,6 @@ class User(Base, Stndrd, Age_times):
def has_badge(self, badgedef_id):
return self.badges.filter_by(badge_id=badgedef_id).first()
@property
@lazy
def patron(self):
if self.id != 147 and (self.has_badge(21) or self.has_badge(22) or self.has_badge(23) or self.has_badge(24)): return True
else: return False
def vote_status_on_post(self, post):

View File

@ -134,8 +134,7 @@ def admin_home(v):
@admin_level_required(4)
def badge_grant_get(v):
badge_types = g.db.query(BadgeDef).filter_by(
kind=3).order_by(BadgeDef.rank).all()
badge_types = g.db.query(BadgeDef).filter_by(kind=3).order_by(BadgeDef.rank).all()
errors = {"already_owned": "That user already has that badge.",
"no_user": "That user doesn't exist."
@ -194,6 +193,10 @@ def badge_grant_post(v):
send_notification(1046, user, text)
if badge_id in [21,22,23,24]:
user.patron = True
g.db.add(user)
return redirect(user.permalink)
@ -589,17 +592,6 @@ def agendaposter(user_id, v):
else:
return redirect(user.url)
@app.route("/patron/<user_id>", methods=["POST"])
@admin_level_required(6)
@validate_formkey
def patron(user_id, v):
user = g.db.query(User).filter_by(id=user_id).first()
user.patron = not user.patron
g.db.add(user)
return "", 204
@app.route("/disablesignups", methods=["POST"])
@admin_level_required(6)
@validate_formkey