diff --git a/files/classes/user.py b/files/classes/user.py index 74a18e7aa0..d68a2cfea6 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -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 diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index d580bf9bfb..31138a7c61 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -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) diff --git a/files/routes/admin.py b/files/routes/admin.py index f1b12f19aa..69819fe74c 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -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//') @admin_level_required(3) def merge(v, id1, id2):