forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-03-17 18:30:13 +02:00
parent 816800b14a
commit 83c88a9834
3 changed files with 11 additions and 19 deletions

View File

@ -481,12 +481,6 @@ class User(Base):
if self.profileurl:
if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl
return self.profileurl
if SITE_NAME == 'Drama':
self.profileurl = '/e/' + random.choice(marseys_const) + '.webp'
try: g.db.add(self)
except: pass
g.db.commit()
return self.profileurl
return f"{SITE_FULL}/static/assets/images/default-profile-pic.webp?v=1008"
@lazy

View File

@ -46,19 +46,7 @@ def notif_comment(text, autojanny=False):
text_html = sanitize(text, alert=True)
try: existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).one_or_none()
except:
existing = g.db.query(Comment).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).all()
notifs = g.db.query(Notification).filter(Notification.comment_id.in_([x.id for x in existing])).all()
for c in notifs: g.db.delete(c)
g.db.flush()
for c in existing: g.db.delete(c)
g.db.flush()
existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).one_or_none()
existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).one_or_none()
if existing: return existing[0]
else: return create_comment(text_html, autojanny)

View File

@ -23,6 +23,16 @@ GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip()
month = datetime.now().strftime('%B')
@app.get('/admin/default')
@admin_level_required(3)
def default(v):
for u in g.db.query(User).filter(User.profileurl == None).all():
u.profileurl = '/e/' + random.choice(marseys_const) + '.webp'
g.db.add(u)
print(u.username, flush=True)
g.db.commit()
return 'done'
@app.get('/admin/merge/<id1>/<id2>')
@admin_level_required(3)
def merge(v, id1, id2):