fdMerge branch 'frost' of https://github.com/Aevann1/Drama into frost

master
Aevann1 2022-07-08 19:08:20 +00:00
commit 2888626bfa
24 changed files with 102 additions and 159 deletions

View File

@ -15,6 +15,7 @@ from .mod_logs import *
from .award import *
from .marsey import *
from .sub_block import *
from .sub_subscription import *
from .saves import *
from .views import *
from .notifications import *

View File

@ -4,6 +4,7 @@ from files.__main__ import Base
from files.helpers.lazy import lazy
from os import environ
from .sub_block import *
from .sub_subscription import *
SITE_NAME = environ.get("SITE_NAME", '').strip()
SITE = environ.get("DOMAIN", '').strip()

View File

@ -1,5 +1,4 @@
from sqlalchemy import *
from sqlalchemy.orm import relationship
from files.__main__ import Base
class SubBlock(Base):
@ -8,13 +7,4 @@ class SubBlock(Base):
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
def __repr__(self):
return f"<SubBlock(user_id={self.user_id}, sub={self.sub})>"
class SubSubscription(Base):
__tablename__ = "sub_subscriptions"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
def __repr__(self):
return f"<SubSubscription(user_id={self.user_id}, sub={self.sub})>"
return f"<SubBlock(user_id={self.user_id}, sub={self.sub})>"

View File

@ -0,0 +1,10 @@
from sqlalchemy import *
from files.__main__ import Base
class SubSubscription(Base):
__tablename__ = "sub_subscriptions"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
def __repr__(self):
return f"<SubSubscription(user_id={self.user_id}, sub={self.sub})>"

View File

@ -17,6 +17,7 @@ from .mod_logs import *
from .mod import *
from .exiles import *
from .sub_block import *
from .sub_subscription import *
from .submission import sort_posts
from files.__main__ import Base, cache
from files.helpers.security import *
@ -450,9 +451,14 @@ class User(Base):
@property
@lazy
def following_ids(self):
def followed_users(self):
return [x[0] for x in g.db.query(Follow.target_id).filter_by(user_id=self.id).all()]
@property
@lazy
def followed_subs(self):
return [x[0] for x in g.db.query(SubSubscription.sub).filter_by(user_id=self.id).all()]
@property
@lazy
def notifications_count(self):
@ -476,7 +482,16 @@ class User(Base):
@property
@lazy
def post_notifications_count(self):
return g.db.query(Submission).filter(Submission.author_id.in_(self.following_ids), Submission.created_utc > self.last_viewed_post_notifs).count()
return g.db.query(Submission).filter(
or_(
Submission.author_id.in_(self.followed_users),
Submission.sub.in_(self.followed_subs)
),
Submission.created_utc > self.last_viewed_post_notifs,
Submission.deleted_utc == 0,
Submission.is_banned == False,
Submission.private == False
).count()
@property
@lazy
@ -486,7 +501,7 @@ class User(Base):
Notification.user_id == self.id, Notification.read == False,
Comment.is_banned == False, Comment.deleted_utc == 0,
Comment.body_html.like(f'%<p>{NOTIF_MODACTION_PREFIX}%'),
Comment.parent_submission == None, Comment.author_id == NOTIFICATIONS_ID).count()
Comment.parent_submission == None, Comment.author_id == AUTOJANNY_ID).count()
@property
@lazy
@ -496,7 +511,7 @@ class User(Base):
Notification.user_id == self.id, Notification.read == False,
Comment.is_banned == False, Comment.deleted_utc == 0,
Comment.body_html.like('%<p>New site mention: <a href="https://old.reddit.com/r/%'),
Comment.parent_submission == None, Comment.author_id == NOTIFICATIONS_ID).count()
Comment.parent_submission == None, Comment.author_id == AUTOJANNY_ID).count()
@property
@lazy

View File

@ -6,14 +6,12 @@ from .regex import *
from pusher_push_notifications import PushNotifications
from sys import stdout
def create_comment(text_html, autojanny=False):
if autojanny: author_id = AUTOJANNY_ID
else: author_id = NOTIFICATIONS_ID
new_comment = Comment(author_id=author_id,
def create_comment(text_html):
new_comment = Comment(author_id=AUTOJANNY_ID,
parent_submission=None,
body_html=text_html,
distinguish_level=6)
distinguish_level=6,
is_bot=True)
g.db.add(new_comment)
g.db.flush()
@ -21,68 +19,46 @@ def create_comment(text_html, autojanny=False):
return new_comment.id
def send_repeatable_notification(uid, text, autojanny=False):
def send_repeatable_notification(uid, text):
if uid in bots: return
if autojanny: author_id = AUTOJANNY_ID
else: author_id = NOTIFICATIONS_ID
text_html = sanitize(text)
existing_comment = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).first()
existing_comment = g.db.query(Comment.id).filter_by(author_id=AUTOJANNY_ID, parent_submission=None, body_html=text_html, is_bot=True).first()
if existing_comment:
cid = existing_comment[0]
existing_notif = g.db.query(Notification.user_id).filter_by(user_id=uid, comment_id=cid).one_or_none()
if existing_notif: cid = create_comment(text_html, autojanny)
else: cid = create_comment(text_html, autojanny)
if existing_notif: cid = create_comment(text_html)
else: cid = create_comment(text_html)
notif = Notification(comment_id=cid, user_id=uid)
g.db.add(notif)
def send_notification(uid, text, autojanny=False):
def send_notification(uid, text):
if uid in bots: return
cid = notif_comment(text, autojanny)
cid = notif_comment(text)
add_notif(cid, uid)
def notif_comment(text, autojanny=False):
if autojanny:
author_id = AUTOJANNY_ID
alert = True
else:
author_id = NOTIFICATIONS_ID
alert = False
def notif_comment(text):
text_html = sanitize(text)
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=AUTOJANNY_ID, parent_submission=None, body_html=text_html, is_bot=True).one_or_none()
if existing: return existing[0]
else: return create_comment(text_html, autojanny)
else: return create_comment(text_html)
def notif_comment2(p):
search_html = f'%</a> has mentioned you: <a href="/post/{p.id}">%'
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.body_html.like(search_html)).first()
existing = g.db.query(Comment.id).filter(Comment.author_id == AUTOJANNY_ID, Comment.parent_submission == None, Comment.body_html.like(search_html)).first()
if existing: return existing[0]
else:
@ -122,11 +98,12 @@ def NOTIFY_USERS(text, v):
def notify_mod_action(by_id, msg):
body_html = sanitize(NOTIF_MODACTION_PREFIX + msg)
new_comment = Comment(
author_id=NOTIFICATIONS_ID,
author_id=AUTOJANNY_ID,
parent_submission=None,
level=1,
body_html=body_html,
distinguish_level=6)
distinguish_level=6,
is_bot=True)
g.db.add(new_comment)
g.db.flush()
new_comment.top_comment_id = new_comment.id
@ -164,24 +141,4 @@ if PUSHER_ID != 'blahblahblah':
}
},
)
stdout.flush()
def on_post_hole_entered(post, v=None):
if not post.sub or not post.subr:
return
hole = post.subr.name
author = post.author
# Notify hole followers
if not post.ghost and not post.private and not author.shadowbanned:
text = f"<a href='/h/{hole}'>/h/{hole}</a> has a new " \
+ f"post: [{post.title}]({post.shortlink}) by @{author.username}"
cid = notif_comment(text, autojanny=True)
for follow in post.subr.followers:
if follow.user_id == author.id or (v and follow.user_id == v.id):
continue
user = get_account(follow.user_id)
if post.club and not user.paid_dues: continue
add_notif(cid, user.id)
stdout.flush()

View File

@ -157,11 +157,10 @@ PIN_LIMIT = 3
POST_RATE_LIMIT = '1/second;2/minute;10/hour;50/day'
LOGGEDIN_ACTIVE_TIME = 15 * 60
NOTIFICATIONS_ID = 1
AUTOJANNY_ID = 2
SNAPPY_ID = 3
LONGPOSTBOT_ID = 4
ZOZBOT_ID = 5
AUTOJANNY_ID = 1
SNAPPY_ID = 2
LONGPOSTBOT_ID = 3
ZOZBOT_ID = 4
BASEDBOT_ID = 0
SCHIZO_ID = 0
@ -201,8 +200,7 @@ if SITE in {'rdrama.net', 'devrama.xyz'}:
HOLE_COST = 50000
HOLE_INACTIVITY_DELETION = True
NOTIFICATIONS_ID = 1046
AUTOJANNY_ID = 2360
AUTOJANNY_ID = 1046
SNAPPY_ID = 261
LONGPOSTBOT_ID = 1832
ZOZBOT_ID = 1833
@ -249,8 +247,7 @@ elif SITE == 'pcmemes.net':
HOLE_COST = 2000
PIN_LIMIT = 6
POST_RATE_LIMIT = '1/second;4/minute;20/hour;100/day'
NOTIFICATIONS_ID = 1046
AUTOJANNY_ID = 1050
AUTOJANNY_ID = 1046
SNAPPY_ID = 261
LONGPOSTBOT_ID = 1832
ZOZBOT_ID = 1833
@ -314,7 +311,7 @@ elif SITE == 'lgbdropthet.com':
else: # localhost or testing environment implied
pass
bots = {NOTIFICATIONS_ID, AUTOJANNY_ID, SNAPPY_ID, LONGPOSTBOT_ID, ZOZBOT_ID, BASEDBOT_ID}
bots = {AUTOJANNY_ID, SNAPPY_ID, LONGPOSTBOT_ID, ZOZBOT_ID, BASEDBOT_ID}
IMGUR_KEY = environ.get("IMGUR_KEY").strip()
PUSHER_ID = environ.get("PUSHER_ID", "").strip()

View File

@ -66,7 +66,7 @@ def give_monthly_marseybux_task():
if u.admin_level or u.id == A_ID or (u.email and u.email.lower() in emails):
procoins = procoins_li[u.patron]
u.procoins += procoins
send_repeatable_notification(u.id, f"@Snappy has given you {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).")
send_repeatable_notification(u.id, f"@AutoJanny has given you {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).")
else: u.patron = 0
ma = ModAction(

View File

@ -119,7 +119,7 @@ def get_account(id, v=None):
return user
def get_post(i, v=None, graceful=False, rendered=False, entered=False):
def get_post(i, v=None, graceful=False):
try: i = int(i)
except: abort(404)

View File

@ -11,7 +11,7 @@ def post_embed(id, v):
try: id = int(id)
except: return None
p = get_post(id, v, graceful=True, rendered=True)
p = get_post(id, v, graceful=True)
if p: return render_template("submission_listing.html", listing=[p], v=v)
return ''
@ -51,7 +51,7 @@ def timestamp(timestamp):
@app.context_processor
def inject_constants():
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL,
"AUTOJANNY_ID":AUTOJANNY_ID, "NOTIFICATIONS_ID":NOTIFICATIONS_ID, "PUSHER_ID":PUSHER_ID,
"AUTOJANNY_ID":AUTOJANNY_ID, "PUSHER_ID":PUSHER_ID,
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID,
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
"COLORS":COLORS, "ADMIGGERS":ADMIGGERS, "datetime":datetime, "time":time,

View File

@ -72,13 +72,13 @@ def notify_mentions(send_to, mentions, mention_str='site mention'):
f'https://old.reddit.com{permalink}?context=89</a></p>{text}' \
existing_comment = g.db.query(Comment.id).filter_by(
author_id=const.NOTIFICATIONS_ID,
author_id=const.AUTOJANNY_ID,
parent_submission=None,
body_html=notif_text).one_or_none()
if existing_comment: continue
new_comment = Comment(
author_id=const.NOTIFICATIONS_ID,
author_id=const.AUTOJANNY_ID,
parent_submission=None,
body_html=notif_text,
distinguish_level=6)

View File

@ -57,7 +57,7 @@ def chart(kind, site):
Comment.created_utc < day_cutoffs[i],
Comment.created_utc > day_cutoffs[i + 1],
Comment.is_banned == False,
Comment.author_id.notin_((AUTOJANNY_ID,NOTIFICATIONS_ID))).count()
Comment.author_id != AUTOJANNY_ID).count()
for i in range(len(day_cutoffs) - 1)][::-1]
plt.rcParams['figure.figsize'] = (chart_width, 20)
@ -114,11 +114,11 @@ def stats(site=None):
"removed posts (by admins)": g.db.query(Submission).filter_by(is_banned=True).count(),
"deleted posts (by author)": g.db.query(Submission).filter(Submission.deleted_utc > 0).count(),
"posts last 24h": g.db.query(Submission).filter(Submission.created_utc > day).count(),
"total comments": g.db.query(Comment).filter(Comment.author_id.notin_((AUTOJANNY_ID,NOTIFICATIONS_ID))).count(),
"total comments": g.db.query(Comment).filter(Comment.author_id != AUTOJANNY_ID).count(),
"commenting users": g.db.query(Comment.author_id).distinct().count(),
"removed comments (by admins)": g.db.query(Comment).filter_by(is_banned=True).count(),
"deleted comments (by author)": g.db.query(Comment).filter(Comment.deleted_utc > 0).count(),
"comments last_24h": g.db.query(Comment).filter(Comment.created_utc > day, Comment.author_id.notin_((AUTOJANNY_ID,NOTIFICATIONS_ID))).count(),
"comments last_24h": g.db.query(Comment).filter(Comment.created_utc > day, Comment.author_id != AUTOJANNY_ID).count(),
"post votes": g.db.query(Vote).count(),
"post voting users": g.db.query(Vote.user_id).distinct().count(),
"comment votes": g.db.query(CommentVote).count(),

View File

@ -106,7 +106,7 @@ def buy(v, award):
@is_not_permabanned
def award_thing(v, thing_type, id):
if thing_type == 'post': thing = get_post(id, rendered=True)
if thing_type == 'post': thing = get_post(id)
else: thing = get_comment(id)
if not thing: return {"error": f"That {thing_type} doesn't exist."}, 404

View File

@ -67,7 +67,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
try: pid = int(pid)
except: abort(404)
post = get_post(pid, v=v, rendered=True)
post = get_post(pid, v=v)
if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()):
if request.headers.get("Authorization"): return {'error': 'This content is not suitable for some users and situations.'}
@ -430,7 +430,7 @@ def api_comment(v):
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
c_jannied = Comment(author_id=AUTOJANNY_ID,
parent_submission=parent_submission,
distinguish_level=6,
parent_comment_id=c.id,
@ -747,7 +747,7 @@ def edit_comment(cid, v):
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
c_jannied = Comment(author_id=AUTOJANNY_ID,
parent_submission=c.parent_submission,
distinguish_level=6,
parent_comment_id=c.id,

View File

@ -335,7 +335,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", gt=0, lt=0,
@auth_required
def transfers(v):
comments = g.db.query(Comment).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.body_html.like("%</a> has transferred %")).order_by(Comment.id.desc())
comments = g.db.query(Comment).filter(Comment.author_id == AUTOJANNY_ID, Comment.parent_submission == None, Comment.body_html.like("%</a> has transferred %")).order_by(Comment.id.desc())
if request.headers.get("Authorization"): return {"data": [x.json for x in comments.all()]}

View File

@ -11,7 +11,7 @@ import requests
@auth_desired
def login_get(v):
redir = request.values.get("redirect")
redir = request.values.get("redirect", "/")
if redir:
redir = redir.replace("/logged_out", "").strip()
if not is_site_url(redir): redir = None
@ -306,7 +306,7 @@ def sign_up_post(v):
ref_id = int(request.values.get("referred_by", 0))
users_count = g.db.query(User).count()
if users_count == 5:
if users_count == 4:
admin_level=3
session["history"] = []
else: admin_level=0

View File

@ -22,7 +22,6 @@ def unread(v):
Notification.user_id == v.id,
Comment.is_banned == False,
Comment.deleted_utc == 0,
Comment.author_id != AUTOJANNY_ID,
).order_by(Notification.created_utc.desc()).all()
for n, c in listing:
@ -88,10 +87,20 @@ def notifications_posts(v):
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
listing = g.db.query(Submission).filter(Submission.author_id.in_(v.following_ids)).order_by(Submission.created_utc.desc()).offset(25 * (page - 1)).limit(26).all()
listing = [x[0] for x in g.db.query(Submission.id).filter(
or_(
Submission.author_id.in_(self.followed_users),
Submission.sub.in_(self.followed_subs)
),
Submission.created_utc > self.last_viewed_post_notifs,
Submission.deleted_utc == 0,
Submission.is_banned == False,
Submission.private == False
).order_by(Submission.created_utc.desc()).offset(25 * (page - 1)).limit(26).all()]
next_exists = (len(listing) > 25)
listing = listing[:25]
listing = get_posts(listing, v=v)
for p in listing:
p.unread = p.created_utc > v.last_viewed_post_notifs
@ -121,7 +130,7 @@ def notifications_modactions(v):
.join(Notification.comment) \
.filter(Notification.user_id == v.id,
Comment.body_html.like(f'%<p>{NOTIF_MODACTION_PREFIX}%'),
Comment.parent_submission == None, Comment.author_id == NOTIFICATIONS_ID) \
Comment.parent_submission == None, Comment.author_id == AUTOJANNY_ID) \
.order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all()
listing = []
@ -158,7 +167,7 @@ def notifications_reddit(v):
if not v.can_view_offsitementions: abort(403)
notifications = g.db.query(Notification, Comment).join(Notification.comment).filter(Notification.user_id == v.id, Comment.body_html.like('%<p>New site mention: <a href="https://old.reddit.com/r/%'), Comment.parent_submission == None, Comment.author_id == NOTIFICATIONS_ID).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all()
notifications = g.db.query(Notification, Comment).join(Notification.comment).filter(Notification.user_id == v.id, Comment.body_html.like('%<p>New site mention: <a href="https://old.reddit.com/r/%'), Comment.parent_submission == None, Comment.author_id == AUTOJANNY_ID).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all()
listing = []
@ -199,7 +208,6 @@ def notifications(v):
Notification.user_id == v.id,
Comment.is_banned == False,
Comment.deleted_utc == 0,
Comment.author_id != AUTOJANNY_ID,
Comment.body_html.notlike('%<p>New site mention: <a href="https://old.reddit.com/r/%'),
Comment.body_html.notlike(f'%<p>{NOTIF_MODACTION_PREFIX}%')
).order_by(Notification.created_utc.desc())

View File

@ -58,12 +58,13 @@ def request_api_keys(v):
body_html = sanitize(body)
new_comment = Comment(author_id=NOTIFICATIONS_ID,
new_comment = Comment(author_id=AUTOJANNY_ID,
parent_submission=None,
level=1,
body_html=body_html,
sentto=2,
distinguish_level=6
distinguish_level=6,
is_bot=True
)
g.db.add(new_comment)
g.db.flush()

View File

@ -63,19 +63,6 @@ def publish(pid, v):
for x in notify_users:
add_notif(cid, x)
if v.followers:
text = f"@{v.username} has made a new post: [{post.title}]({post.shortlink})"
if post.sub: text += f" in <a href='/h/{post.sub}'>/h/{post.sub}"
cid = notif_comment(text, autojanny=True)
for follow in v.followers:
user = get_account(follow.user_id)
if post.club and not user.paid_dues: continue
add_notif(cid, user.id)
if post.sub:
on_post_hole_entered(post, v)
cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting)
@ -124,7 +111,7 @@ def post_id(pid, anything=None, v=None, sub=None):
try: pid = int(pid)
except: abort(404)
post = get_post(pid, v=v, rendered=True, entered=True)
post = get_post(pid, v=v)
if post.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"Must be 18+ to view"}, 451
@ -389,7 +376,7 @@ def morecomments(v, cid):
@limiter.limit("1/second;10/minute;100/hour;200/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
@auth_required
def edit_post(pid, v):
p = get_post(pid, rendered=True)
p = get_post(pid)
title = request.values.get("title", "").strip().replace('','')
@ -468,7 +455,7 @@ def edit_post(pid, v):
body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
c_jannied = Comment(author_id=AUTOJANNY_ID,
parent_submission=p.id,
level=1,
over_18=False,
@ -1016,19 +1003,6 @@ def submit_post(v, sub=None):
for x in notify_users:
add_notif(cid, x)
if (request.values.get('followers') or is_bot) and v.followers:
text = f"@{v.username} has made a new post: [{post.title}]({post.shortlink})"
if post.sub: text += f" in <a href='/h/{post.sub}'>/h/{post.sub}"
cid = notif_comment(text, autojanny=True)
for follow in v.followers:
user = get_account(follow.user_id)
if post.club and not user.paid_dues: continue
add_notif(cid, user.id)
if post.sub:
on_post_hole_entered(post, v)
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{post.body}{post.title}'.lower():
post.is_banned = True
post.ban_reason = "AutoJanny"
@ -1038,7 +1012,7 @@ def submit_post(v, sub=None):
body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
c_jannied = Comment(author_id=AUTOJANNY_ID,
parent_submission=post.id,
level=1,
over_18=False,

View File

@ -64,8 +64,6 @@ def api_flag_post(pid, v):
)
g.db.add(ma)
on_post_hole_entered(post, v)
return {"message": f"Post moved to /h/{post.sub}"}
else:
flag = Flag(post_id=post.id, user_id=v.id, reason=reason)

View File

@ -639,7 +639,7 @@ def settings_block_user(v):
if v.has_blocked(user):
return {"error": f"You have already blocked @{user.username}."}, 409
if user.id == NOTIFICATIONS_ID:
if user.id == AUTOJANNY_ID:
return {"error": "You can't block this user."}, 409
new_block = UserBlock(user_id=v.id,

View File

@ -133,8 +133,8 @@
{% if c.post.sub %}
<span class="ml-1"> in <a href="/h/{{c.post.sub}}" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>/h/{{c.post.sub}}</a></span>
{% endif %}
{% elif c.author_id==NOTIFICATIONS_ID or c.author_id==AUTOJANNY_ID %}
<span class="font-weight-bold">Notification</span>
{% elif c.author_id==AUTOJANNY_ID %}
<span class="font-weight-bold">Notification</span>
{% else %}
{% if c.sentto == 2 %}
<span class="font-weight-bold">Sent to admins</span>
@ -596,7 +596,7 @@
</div>
{% endif %}
{% if request.path == '/notifications' and c.level == 1 and c.sentto and not c.parent_submission and c.author_id not in (NOTIFICATIONS_ID, AUTOJANNY_ID) %}
{% if request.path == '/notifications' and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %}
<a class="btn btn-primary mt-2" role="button" onclick="openReplyBox('reply-message-{{c.id}}')">Reply</a>
<div id="reply-message-{{c.id}}" class="d-none">
<div id="comment-form-space-{{c.id}}" class="comment-write collapsed child">

View File

@ -163,11 +163,6 @@
<div class="form-text text-small"><a href="/formatting" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>Formatting help</a></div>
<pre></pre>
<div class="custom-control custom-checkbox">
<input checked autocomplete="off" type="checkbox" class="custom-control-input" id="followers" name="followers">
<label class="custom-control-label" for="followers">Notify followers</label>
</div>
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="new" name="new">
<label class="custom-control-label" for="new">Make the default comment sorting "new"</label>

View File

@ -2,26 +2,22 @@ INSERT INTO public.users (username, passhash, created_utc, admin_level, over_18,
unban_utc, original_username, customtitle, defaultsorting, defaultsortingcomments, defaulttime, namecolor, titlecolor,
customtitleplain, theme, themecolor, changelogsub, reddit, css, profilecss, coins, agendaposter,
post_count, comment_count, background, verified, truecoins, cardview, profileurl, highres
) VALUES ('System', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'System', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac',
'', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false, '/i/pfps/2.webp', '/i/pfps/2.webp'),
('AutoJanny', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
) VALUES ('AutoJanny', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'AutoJanny', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac',
'', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false, '/i/pfps/2.webp', '/i/pfps/2.webp'),
0, 0, '', 'Verified', 0, false, '/i/pfps/1.webp', '/i/pfps/1.webp'),
('Snappy', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'Snappy', '', 'hot', 'top', 'day', '62ca56', 'e4432d',
'', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false, '/i/pfps/3.webp', '/i/pfps/3.webp'),
0, 0, '', 'Verified', 0, false, '/i/pfps/2.webp', '/i/pfps/2.webp'),
('longpostbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'longpostbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d',
'', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false, '/i/pfps/4.webp', '/i/pfps/4.webp'),
0, 0, '', 'Verified', 0, false, '/i/pfps/3.webp', '/i/pfps/3.webp'),
('zozbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'zozbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d',
'', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false, '/i/pfps/5.webp', '/i/pfps/5.webp');
0, 0, '', 'Verified', 0, false, '/i/pfps/4.webp', '/i/pfps/4.webp');
INSERT INTO public.marseys VALUES
('marseylaugh',1,'lmao reaction point funny haha lol judgment',0),