forked from MarseyWorld/MarseyWorld
complement 32fa466e6a
parent
e607c39d67
commit
d9bed378a9
|
@ -72,7 +72,7 @@ def add_options(self, body, v):
|
||||||
if v:
|
if v:
|
||||||
if kind == 'post':
|
if kind == 'post':
|
||||||
sub = self.sub
|
sub = self.sub
|
||||||
elif self.parent_submission:
|
elif self.parent_post:
|
||||||
sub = self.post.sub
|
sub = self.post.sub
|
||||||
else:
|
else:
|
||||||
sub = None
|
sub = None
|
||||||
|
@ -105,7 +105,7 @@ class Comment(Base):
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
author_id = Column(Integer, ForeignKey("users.id"))
|
author_id = Column(Integer, ForeignKey("users.id"))
|
||||||
parent_submission = Column(Integer, ForeignKey("posts.id"))
|
parent_post = Column(Integer, ForeignKey("posts.id"))
|
||||||
wall_user_id = Column(Integer, ForeignKey("users.id"))
|
wall_user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
created_utc = Column(Integer)
|
created_utc = Column(Integer)
|
||||||
edited_utc = Column(Integer, default=0)
|
edited_utc = Column(Integer, default=0)
|
||||||
|
@ -203,7 +203,7 @@ class Comment(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def parent_fullname(self):
|
def parent_fullname(self):
|
||||||
if self.parent_comment_id: return f"c_{self.parent_comment_id}"
|
if self.parent_comment_id: return f"c_{self.parent_comment_id}"
|
||||||
elif self.parent_submission: return f"p_{self.parent_submission}"
|
elif self.parent_post: return f"p_{self.parent_post}"
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def replies(self, sort, v):
|
def replies(self, sort, v):
|
||||||
|
@ -211,7 +211,7 @@ class Comment(Base):
|
||||||
return self.replies2
|
return self.replies2
|
||||||
|
|
||||||
replies = g.db.query(Comment).filter_by(parent_comment_id=self.id).order_by(Comment.stickied, Comment.stickied_child_id)
|
replies = g.db.query(Comment).filter_by(parent_comment_id=self.id).order_by(Comment.stickied, Comment.stickied_child_id)
|
||||||
if not self.parent_submission: sort='old'
|
if not self.parent_post: sort='old'
|
||||||
return sort_objects(sort, replies, Comment).all()
|
return sort_objects(sort, replies, Comment).all()
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ class Comment(Base):
|
||||||
body = add_options(self, body, v)
|
body = add_options(self, body, v)
|
||||||
|
|
||||||
if body:
|
if body:
|
||||||
if not (self.parent_submission and self.post.sub == 'chudrama'):
|
if not (self.parent_post and self.post.sub == 'chudrama'):
|
||||||
body = censor_slurs(body, v)
|
body = censor_slurs(body, v)
|
||||||
|
|
||||||
body = normalize_urls_runtime(body, v)
|
body = normalize_urls_runtime(body, v)
|
||||||
|
@ -371,7 +371,7 @@ class Comment(Base):
|
||||||
|
|
||||||
if not body: return ""
|
if not body: return ""
|
||||||
|
|
||||||
if not (self.parent_submission and self.post.sub == 'chudrama'):
|
if not (self.parent_post and self.post.sub == 'chudrama'):
|
||||||
body = censor_slurs(body, v).replace('<img loading="lazy" data-bs-toggle="tooltip" alt=":marseytrain:" title=":marseytrain:" src="/e/marseytrain.webp">', ':marseytrain:')
|
body = censor_slurs(body, v).replace('<img loading="lazy" data-bs-toggle="tooltip" alt=":marseytrain:" title=":marseytrain:" src="/e/marseytrain.webp">', ':marseytrain:')
|
||||||
|
|
||||||
return body
|
return body
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Post(Base):
|
||||||
approved_by = relationship("User", uselist=False, primaryjoin="Post.is_approved==User.id")
|
approved_by = relationship("User", uselist=False, primaryjoin="Post.is_approved==User.id")
|
||||||
awards = relationship("AwardRelationship", order_by="AwardRelationship.awarded_utc.desc()", back_populates="post")
|
awards = relationship("AwardRelationship", order_by="AwardRelationship.awarded_utc.desc()", back_populates="post")
|
||||||
flags = relationship("Flag", order_by="Flag.created_utc")
|
flags = relationship("Flag", order_by="Flag.created_utc")
|
||||||
comments = relationship("Comment", primaryjoin="Comment.parent_submission==Post.id", back_populates="post")
|
comments = relationship("Comment", primaryjoin="Comment.parent_post==Post.id", back_populates="post")
|
||||||
subr = relationship("Sub", primaryjoin="foreign(Post.sub)==remote(Sub.name)")
|
subr = relationship("Sub", primaryjoin="foreign(Post.sub)==remote(Sub.name)")
|
||||||
options = relationship("PostOption", order_by="PostOption.id")
|
options = relationship("PostOption", order_by="PostOption.id")
|
||||||
|
|
||||||
|
|
|
@ -698,7 +698,7 @@ class User(Base):
|
||||||
Notification.read == False,
|
Notification.read == False,
|
||||||
Comment.sentto != None,
|
Comment.sentto != None,
|
||||||
or_(Comment.author_id==self.id, Comment.sentto==self.id),
|
or_(Comment.author_id==self.id, Comment.sentto==self.id),
|
||||||
Comment.parent_submission == None,
|
Comment.parent_post == None,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not self.can_see_shadowbanned:
|
if not self.can_see_shadowbanned:
|
||||||
|
@ -762,7 +762,7 @@ class User(Base):
|
||||||
Comment.created_utc > self.last_viewed_reddit_notifs,
|
Comment.created_utc > self.last_viewed_reddit_notifs,
|
||||||
Comment.is_banned == False, Comment.deleted_utc == 0,
|
Comment.is_banned == False, Comment.deleted_utc == 0,
|
||||||
Comment.body_html.like('%<p>New site mention%<a href="https://old.reddit.com/r/%'),
|
Comment.body_html.like('%<p>New site mention%<a href="https://old.reddit.com/r/%'),
|
||||||
Comment.parent_submission == None, Comment.author_id == AUTOJANNY_ID).count()
|
Comment.parent_post == None, Comment.author_id == AUTOJANNY_ID).count()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
@ -1040,7 +1040,7 @@ class User(Base):
|
||||||
if other.deleted_utc: return False
|
if other.deleted_utc: return False
|
||||||
if other.author.shadowbanned and not (user and user.can_see_shadowbanned): return False
|
if other.author.shadowbanned and not (user and user.can_see_shadowbanned): return False
|
||||||
if isinstance(other, Comment):
|
if isinstance(other, Comment):
|
||||||
if other.parent_submission and not cls.can_see(user, other.post): return False
|
if other.parent_post and not cls.can_see(user, other.post): return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -1063,7 +1063,7 @@ class User(Base):
|
||||||
if SITE == 'watchpeopledie.tv' and other.id == 5:
|
if SITE == 'watchpeopledie.tv' and other.id == 5:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
if other.parent_submission:
|
if other.parent_post:
|
||||||
return cls.can_see(user, other.post)
|
return cls.can_see(user, other.post)
|
||||||
else:
|
else:
|
||||||
if not user and not other.wall_user_id: return False
|
if not user and not other.wall_user_id: return False
|
||||||
|
|
|
@ -204,7 +204,7 @@ def execute_snappy(post:Post, v:User):
|
||||||
if len(body_html) < COMMENT_BODY_HTML_LENGTH_LIMIT:
|
if len(body_html) < COMMENT_BODY_HTML_LENGTH_LIMIT:
|
||||||
c = Comment(author_id=SNAPPY_ID,
|
c = Comment(author_id=SNAPPY_ID,
|
||||||
distinguish_level=6,
|
distinguish_level=6,
|
||||||
parent_submission=post.id,
|
parent_post=post.id,
|
||||||
level=1,
|
level=1,
|
||||||
over_18=False,
|
over_18=False,
|
||||||
is_bot=True,
|
is_bot=True,
|
||||||
|
@ -256,11 +256,11 @@ def execute_snappy(post:Post, v:User):
|
||||||
|
|
||||||
def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v):
|
def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v):
|
||||||
if SITE_NAME != 'rDrama': return
|
if SITE_NAME != 'rDrama': return
|
||||||
posting_to_submission = isinstance(post_target, Post)
|
posting_to_post = isinstance(post_target, Post)
|
||||||
if random.random() >= 0.001: return
|
if random.random() >= 0.001: return
|
||||||
c2 = Comment(author_id=ZOZBOT_ID,
|
c2 = Comment(author_id=ZOZBOT_ID,
|
||||||
parent_submission=post_target.id if posting_to_submission else None,
|
parent_post=post_target.id if posting_to_post else None,
|
||||||
wall_user_id=post_target.id if not posting_to_submission else None,
|
wall_user_id=post_target.id if not posting_to_post else None,
|
||||||
parent_comment_id=c.id,
|
parent_comment_id=c.id,
|
||||||
level=level+1,
|
level=level+1,
|
||||||
is_bot=True,
|
is_bot=True,
|
||||||
|
@ -277,8 +277,8 @@ def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v):
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
c3 = Comment(author_id=ZOZBOT_ID,
|
c3 = Comment(author_id=ZOZBOT_ID,
|
||||||
parent_submission=post_target.id if posting_to_submission else None,
|
parent_post=post_target.id if posting_to_post else None,
|
||||||
wall_user_id=post_target.id if not posting_to_submission else None,
|
wall_user_id=post_target.id if not posting_to_post else None,
|
||||||
parent_comment_id=c2.id,
|
parent_comment_id=c2.id,
|
||||||
level=level+2,
|
level=level+2,
|
||||||
is_bot=True,
|
is_bot=True,
|
||||||
|
@ -294,8 +294,8 @@ def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v):
|
||||||
|
|
||||||
|
|
||||||
c4 = Comment(author_id=ZOZBOT_ID,
|
c4 = Comment(author_id=ZOZBOT_ID,
|
||||||
parent_submission=post_target.id if posting_to_submission else None,
|
parent_post=post_target.id if posting_to_post else None,
|
||||||
wall_user_id=post_target.id if not posting_to_submission else None,
|
wall_user_id=post_target.id if not posting_to_post else None,
|
||||||
parent_comment_id=c3.id,
|
parent_comment_id=c3.id,
|
||||||
level=level+3,
|
level=level+3,
|
||||||
is_bot=True,
|
is_bot=True,
|
||||||
|
@ -313,7 +313,7 @@ def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v):
|
||||||
zozbot.pay_account('coins', 1)
|
zozbot.pay_account('coins', 1)
|
||||||
g.db.add(zozbot)
|
g.db.add(zozbot)
|
||||||
|
|
||||||
if posting_to_submission:
|
if posting_to_post:
|
||||||
post_target.comment_count += 3
|
post_target.comment_count += 3
|
||||||
g.db.add(post_target)
|
g.db.add(post_target)
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v):
|
||||||
|
|
||||||
def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_target_type, v:User):
|
def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_target_type, v:User):
|
||||||
if SITE_NAME != 'rDrama': return
|
if SITE_NAME != 'rDrama': return
|
||||||
posting_to_submission = isinstance(post_target, Post)
|
posting_to_post = isinstance(post_target, Post)
|
||||||
if not len(c.body.split()) >= 200: return
|
if not len(c.body.split()) >= 200: return
|
||||||
if "</blockquote>" in body_html: return
|
if "</blockquote>" in body_html: return
|
||||||
body = random.choice(LONGPOST_REPLIES)
|
body = random.choice(LONGPOST_REPLIES)
|
||||||
|
@ -338,8 +338,8 @@ def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_
|
||||||
body_html = sanitize(body)
|
body_html = sanitize(body)
|
||||||
|
|
||||||
c2 = Comment(author_id=LONGPOSTBOT_ID,
|
c2 = Comment(author_id=LONGPOSTBOT_ID,
|
||||||
parent_submission=post_target.id if posting_to_submission else None,
|
parent_post=post_target.id if posting_to_post else None,
|
||||||
wall_user_id=post_target.id if not posting_to_submission else None,
|
wall_user_id=post_target.id if not posting_to_post else None,
|
||||||
parent_comment_id=c.id,
|
parent_comment_id=c.id,
|
||||||
level=level+1,
|
level=level+1,
|
||||||
is_bot=True,
|
is_bot=True,
|
||||||
|
@ -359,13 +359,13 @@ def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_
|
||||||
n = Notification(comment_id=c2.id, user_id=v.id)
|
n = Notification(comment_id=c2.id, user_id=v.id)
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
if posting_to_submission:
|
if posting_to_post:
|
||||||
post_target.comment_count += 3
|
post_target.comment_count += 3
|
||||||
g.db.add(post_target)
|
g.db.add(post_target)
|
||||||
|
|
||||||
push_notif({v.id}, f'New reply by @{c2.author_name}', c2.body, c2)
|
push_notif({v.id}, f'New reply by @{c2.author_name}', c2.body, c2)
|
||||||
|
|
||||||
def execute_antispam_submission_check(title, v, url):
|
def execute_antispam_post_check(title, v, url):
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
cutoff = now - 60 * 60 * 24
|
cutoff = now - 60 * 60 * 24
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ from .sanitize import *
|
||||||
|
|
||||||
def create_comment(text_html):
|
def create_comment(text_html):
|
||||||
new_comment = Comment(author_id=AUTOJANNY_ID,
|
new_comment = Comment(author_id=AUTOJANNY_ID,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
body_html=text_html,
|
body_html=text_html,
|
||||||
distinguish_level=6,
|
distinguish_level=6,
|
||||||
is_bot=True)
|
is_bot=True)
|
||||||
|
@ -32,7 +32,7 @@ def send_repeatable_notification(uid, text):
|
||||||
|
|
||||||
text_html = sanitize(text, blackjack="notification")
|
text_html = sanitize(text, blackjack="notification")
|
||||||
|
|
||||||
existing_comments = g.db.query(Comment.id).filter_by(author_id=AUTOJANNY_ID, parent_submission=None, body_html=text_html, is_bot=True).order_by(Comment.id).all()
|
existing_comments = g.db.query(Comment.id).filter_by(author_id=AUTOJANNY_ID, parent_post=None, body_html=text_html, is_bot=True).order_by(Comment.id).all()
|
||||||
|
|
||||||
for c in existing_comments:
|
for c in existing_comments:
|
||||||
existing_notif = g.db.query(Notification.user_id).filter_by(user_id=uid, comment_id=c.id).one_or_none()
|
existing_notif = g.db.query(Notification.user_id).filter_by(user_id=uid, comment_id=c.id).one_or_none()
|
||||||
|
@ -65,7 +65,7 @@ def notif_comment(text):
|
||||||
|
|
||||||
existing = g.db.query(Comment.id).filter(
|
existing = g.db.query(Comment.id).filter(
|
||||||
Comment.author_id == AUTOJANNY_ID,
|
Comment.author_id == AUTOJANNY_ID,
|
||||||
Comment.parent_submission == None,
|
Comment.parent_post == None,
|
||||||
Comment.body_html == text_html,
|
Comment.body_html == text_html,
|
||||||
Comment.is_bot == True,
|
Comment.is_bot == True,
|
||||||
).order_by(Comment.id).all()
|
).order_by(Comment.id).all()
|
||||||
|
@ -96,7 +96,7 @@ def notif_comment2(p):
|
||||||
|
|
||||||
search_html = f'%</a> has mentioned you: <a href="/post/{p.id}"%'
|
search_html = f'%</a> has mentioned you: <a href="/post/{p.id}"%'
|
||||||
|
|
||||||
existing = g.db.query(Comment.id).filter(Comment.author_id == AUTOJANNY_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_post == None, Comment.body_html.like(search_html)).first()
|
||||||
|
|
||||||
if existing: return existing[0], text
|
if existing: return existing[0], text
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -107,13 +107,13 @@ def notify_mentions(mentions, send_to=None, mention_str='site mention'):
|
||||||
|
|
||||||
existing_comment = g.db.query(Comment.id).filter_by(
|
existing_comment = g.db.query(Comment.id).filter_by(
|
||||||
author_id=const.AUTOJANNY_ID,
|
author_id=const.AUTOJANNY_ID,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
body_html=notif_text).one_or_none()
|
body_html=notif_text).one_or_none()
|
||||||
if existing_comment: break
|
if existing_comment: break
|
||||||
|
|
||||||
new_comment = Comment(
|
new_comment = Comment(
|
||||||
author_id=const.AUTOJANNY_ID,
|
author_id=const.AUTOJANNY_ID,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
body_html=notif_text,
|
body_html=notif_text,
|
||||||
distinguish_level=6)
|
distinguish_level=6)
|
||||||
g.db.add(new_comment)
|
g.db.add(new_comment)
|
||||||
|
|
|
@ -138,7 +138,7 @@ url_re = build_url_re(tlds=TLDS, protocols=['http', 'https'])
|
||||||
|
|
||||||
def create_comment_duplicated(text_html):
|
def create_comment_duplicated(text_html):
|
||||||
new_comment = Comment(author_id=AUTOJANNY_ID,
|
new_comment = Comment(author_id=AUTOJANNY_ID,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
body_html=text_html,
|
body_html=text_html,
|
||||||
distinguish_level=6,
|
distinguish_level=6,
|
||||||
is_bot=True)
|
is_bot=True)
|
||||||
|
@ -155,7 +155,7 @@ def send_repeatable_notification_duplicated(uid, text):
|
||||||
|
|
||||||
text_html = sanitize(text)
|
text_html = sanitize(text)
|
||||||
|
|
||||||
existing_comments = g.db.query(Comment.id).filter_by(author_id=AUTOJANNY_ID, parent_submission=None, body_html=text_html, is_bot=True).order_by(Comment.id).all()
|
existing_comments = g.db.query(Comment.id).filter_by(author_id=AUTOJANNY_ID, parent_post=None, body_html=text_html, is_bot=True).order_by(Comment.id).all()
|
||||||
|
|
||||||
for c in existing_comments:
|
for c in existing_comments:
|
||||||
existing_notif = g.db.query(Notification.user_id).filter_by(user_id=uid, comment_id=c.id).one_or_none()
|
existing_notif = g.db.query(Notification.user_id).filter_by(user_id=uid, comment_id=c.id).one_or_none()
|
||||||
|
@ -735,8 +735,8 @@ def complies_with_chud(obj):
|
||||||
if isinstance(obj, Post):
|
if isinstance(obj, Post):
|
||||||
if obj.id in ADMIGGER_THREADS: return True
|
if obj.id in ADMIGGER_THREADS: return True
|
||||||
if obj.sub == "chudrama": return True
|
if obj.sub == "chudrama": return True
|
||||||
elif obj.parent_submission:
|
elif obj.parent_post:
|
||||||
if obj.parent_submission in ADMIGGER_THREADS: return True
|
if obj.parent_post in ADMIGGER_THREADS: return True
|
||||||
if obj.post.sub == "chudrama": return True
|
if obj.post.sub == "chudrama": return True
|
||||||
|
|
||||||
if obj.author.chud:
|
if obj.author.chud:
|
||||||
|
|
|
@ -145,7 +145,7 @@ def award_thing(v, thing_type, id):
|
||||||
thing = get_post(id)
|
thing = get_post(id)
|
||||||
else:
|
else:
|
||||||
thing = get_comment(id)
|
thing = get_comment(id)
|
||||||
if not thing.parent_submission and not thing.wall_user_id: abort(404) # don't let users award messages
|
if not thing.parent_post and not thing.wall_user_id: abort(404) # don't let users award messages
|
||||||
|
|
||||||
if v.shadowbanned: abort(500)
|
if v.shadowbanned: abort(500)
|
||||||
author = thing.author
|
author = thing.author
|
||||||
|
|
|
@ -40,8 +40,8 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
if comment.parent_submission:
|
if comment.parent_post:
|
||||||
post = comment.parent_submission
|
post = comment.parent_post
|
||||||
else:
|
else:
|
||||||
post = NOTIFICATION_THREAD
|
post = NOTIFICATION_THREAD
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ def comment(v:User):
|
||||||
ghost = parent.ghost
|
ghost = parent.ghost
|
||||||
elif parent_fullname.startswith("c_"):
|
elif parent_fullname.startswith("c_"):
|
||||||
parent = get_comment(id, v=v)
|
parent = get_comment(id, v=v)
|
||||||
post_target = get_post(parent.parent_submission, v=v, graceful=True) or get_account(parent.wall_user_id, v=v, include_blocks=True)
|
post_target = get_post(parent.parent_post, v=v, graceful=True) or get_account(parent.wall_user_id, v=v, include_blocks=True)
|
||||||
parent_comment_id = parent.id
|
parent_comment_id = parent.id
|
||||||
if parent.author_id == v.id: rts = True
|
if parent.author_id == v.id: rts = True
|
||||||
if not v.can_post_in_ghost_threads and isinstance(post_target, Post) and post_target.ghost:
|
if not v.can_post_in_ghost_threads and isinstance(post_target, Post) and post_target.ghost:
|
||||||
|
@ -135,7 +135,7 @@ def comment(v:User):
|
||||||
|
|
||||||
level = 1 if isinstance(parent, (Post, User)) else int(parent.level) + 1
|
level = 1 if isinstance(parent, (Post, User)) else int(parent.level) + 1
|
||||||
parent_user = parent if isinstance(parent, User) else parent.author
|
parent_user = parent if isinstance(parent, User) else parent.author
|
||||||
posting_to_submission = isinstance(post_target, Post)
|
posting_to_post = isinstance(post_target, Post)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ def comment(v:User):
|
||||||
else:
|
else:
|
||||||
abort(403, "You can't reply to deleted comments!")
|
abort(403, "You can't reply to deleted comments!")
|
||||||
|
|
||||||
if posting_to_submission:
|
if posting_to_post:
|
||||||
sub = post_target.sub
|
sub = post_target.sub
|
||||||
if sub and v.exiled_from(sub): abort(403, f"You're exiled from /h/{sub}")
|
if sub and v.exiled_from(sub): abort(403, f"You're exiled from /h/{sub}")
|
||||||
if sub in {'furry','vampire','racist','femboy'} and not v.client and not v.house.lower().startswith(sub):
|
if sub in {'furry','vampire','racist','femboy'} and not v.client and not v.house.lower().startswith(sub):
|
||||||
|
@ -156,7 +156,7 @@ def comment(v:User):
|
||||||
|
|
||||||
body = sanitize_raw_body(request.values.get("body", ""), False)
|
body = sanitize_raw_body(request.values.get("body", ""), False)
|
||||||
|
|
||||||
if not posting_to_submission or post_target.id not in ADMIGGER_THREADS:
|
if not posting_to_post or post_target.id not in ADMIGGER_THREADS:
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||||
abort(403, "You have to type more than 280 characters!")
|
abort(403, "You have to type more than 280 characters!")
|
||||||
elif v.bird and len(body) > 140:
|
elif v.bird and len(body) > 140:
|
||||||
|
@ -183,7 +183,7 @@ def comment(v:User):
|
||||||
file.save(oldname)
|
file.save(oldname)
|
||||||
image = process_image(oldname, v)
|
image = process_image(oldname, v)
|
||||||
if image == "": abort(400, "Image upload failed")
|
if image == "": abort(400, "Image upload failed")
|
||||||
if posting_to_submission and v.admin_level >= PERMS['USE_ADMIGGER_THREADS']:
|
if posting_to_post and v.admin_level >= PERMS['USE_ADMIGGER_THREADS']:
|
||||||
def process_sidebar_or_banner(type, resize=0):
|
def process_sidebar_or_banner(type, resize=0):
|
||||||
li = sorted(os.listdir(f'files/assets/images/{SITE_NAME}/{type}'),
|
li = sorted(os.listdir(f'files/assets/images/{SITE_NAME}/{type}'),
|
||||||
key=lambda e: int(e.split('.webp')[0]))[-1]
|
key=lambda e: int(e.split('.webp')[0]))[-1]
|
||||||
|
@ -232,7 +232,7 @@ def comment(v:User):
|
||||||
body = body.replace('\n ', '\n')
|
body = body.replace('\n ', '\n')
|
||||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT]
|
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT]
|
||||||
|
|
||||||
if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_submission and post_target.id == SNAPPY_THREAD and level == 1 and body not in SNAPPY_QUOTES:
|
if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_post and post_target.id == SNAPPY_THREAD and level == 1 and body not in SNAPPY_QUOTES:
|
||||||
with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f:
|
with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f:
|
||||||
f.write('\n{[para]}\n' + body)
|
f.write('\n{[para]}\n' + body)
|
||||||
|
|
||||||
|
@ -247,8 +247,8 @@ def comment(v:User):
|
||||||
Comment.author_id == v.id,
|
Comment.author_id == v.id,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.parent_comment_id == parent_comment_id,
|
Comment.parent_comment_id == parent_comment_id,
|
||||||
Comment.parent_submission == post_target.id if posting_to_submission else None,
|
Comment.parent_post == post_target.id if posting_to_post else None,
|
||||||
Comment.wall_user_id == post_target.id if not posting_to_submission else None,
|
Comment.wall_user_id == post_target.id if not posting_to_post else None,
|
||||||
Comment.body_html == body_html
|
Comment.body_html == body_html
|
||||||
).first()
|
).first()
|
||||||
if existing: abort(409, f"You already made that comment: /comment/{existing.id}#context")
|
if existing: abort(409, f"You already made that comment: /comment/{existing.id}#context")
|
||||||
|
@ -256,7 +256,7 @@ def comment(v:User):
|
||||||
execute_antispam_comment_check(body, v)
|
execute_antispam_comment_check(body, v)
|
||||||
execute_antispam_duplicate_comment_check(v, body_html)
|
execute_antispam_duplicate_comment_check(v, body_html)
|
||||||
|
|
||||||
if v.marseyawarded and posting_to_submission and post_target.id not in ADMIGGER_THREADS and marseyaward_body_regex.search(body_html):
|
if v.marseyawarded and posting_to_post and post_target.id not in ADMIGGER_THREADS and marseyaward_body_regex.search(body_html):
|
||||||
abort(403, "You can only type marseys!")
|
abort(403, "You can only type marseys!")
|
||||||
|
|
||||||
if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT:
|
if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT:
|
||||||
|
@ -264,14 +264,14 @@ def comment(v:User):
|
||||||
|
|
||||||
is_bot = v.client is not None and v.id not in PRIVILEGED_USER_BOTS
|
is_bot = v.client is not None and v.id not in PRIVILEGED_USER_BOTS
|
||||||
|
|
||||||
chudded = v.chud and not (posting_to_submission and post_target.sub == 'chudrama')
|
chudded = v.chud and not (posting_to_post and post_target.sub == 'chudrama')
|
||||||
|
|
||||||
c = Comment(author_id=v.id,
|
c = Comment(author_id=v.id,
|
||||||
parent_submission=post_target.id if posting_to_submission else None,
|
parent_post=post_target.id if posting_to_post else None,
|
||||||
wall_user_id=post_target.id if not posting_to_submission else None,
|
wall_user_id=post_target.id if not posting_to_post else None,
|
||||||
parent_comment_id=parent_comment_id,
|
parent_comment_id=parent_comment_id,
|
||||||
level=level,
|
level=level,
|
||||||
over_18=post_target.over_18 if posting_to_submission else False,
|
over_18=post_target.over_18 if posting_to_post else False,
|
||||||
is_bot=is_bot,
|
is_bot=is_bot,
|
||||||
app_id=v.client.application.id if v.client else None,
|
app_id=v.client.application.id if v.client else None,
|
||||||
body_html=body_html,
|
body_html=body_html,
|
||||||
|
@ -301,8 +301,8 @@ def comment(v:User):
|
||||||
body_jannied_html = sanitize(body)
|
body_jannied_html = sanitize(body)
|
||||||
|
|
||||||
c_jannied = Comment(author_id=AUTOJANNY_ID,
|
c_jannied = Comment(author_id=AUTOJANNY_ID,
|
||||||
parent_submission=post_target.id if posting_to_submission else None,
|
parent_post=post_target.id if posting_to_post else None,
|
||||||
wall_user_id=post_target.id if not posting_to_submission else None,
|
wall_user_id=post_target.id if not posting_to_post else None,
|
||||||
distinguish_level=6,
|
distinguish_level=6,
|
||||||
parent_comment_id=c.id,
|
parent_comment_id=c.id,
|
||||||
level=level+1,
|
level=level+1,
|
||||||
|
@ -316,7 +316,7 @@ def comment(v:User):
|
||||||
g.db.add(c_jannied)
|
g.db.add(c_jannied)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
if posting_to_submission:
|
if posting_to_post:
|
||||||
post_target.comment_count += 1
|
post_target.comment_count += 1
|
||||||
g.db.add(post_target)
|
g.db.add(post_target)
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ def comment(v:User):
|
||||||
else:
|
else:
|
||||||
push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c)
|
push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c)
|
||||||
|
|
||||||
if c.level == 1 and posting_to_submission:
|
if c.level == 1 and posting_to_post:
|
||||||
subscriber_ids = [x[0] for x in g.db.query(Subscription.user_id).filter(Subscription.post_id == post_target.id, Subscription.user_id != v.id).all()]
|
subscriber_ids = [x[0] for x in g.db.query(Subscription.user_id).filter(Subscription.post_id == post_target.id, Subscription.user_id != v.id).all()]
|
||||||
|
|
||||||
notify_users.update(subscriber_ids)
|
notify_users.update(subscriber_ids)
|
||||||
|
@ -370,7 +370,7 @@ def comment(v:User):
|
||||||
|
|
||||||
v.comment_count = g.db.query(Comment).filter(
|
v.comment_count = g.db.query(Comment).filter(
|
||||||
Comment.author_id == v.id,
|
Comment.author_id == v.id,
|
||||||
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
or_(Comment.parent_post != None, Comment.wall_user_id != None),
|
||||||
Comment.deleted_utc == 0
|
Comment.deleted_utc == 0
|
||||||
).count()
|
).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -382,7 +382,7 @@ def comment(v:User):
|
||||||
|
|
||||||
# Increment post count iff not self-reply and not a spammy comment game
|
# Increment post count iff not self-reply and not a spammy comment game
|
||||||
# Essentially a measure to make comment counts reflect "real" content
|
# Essentially a measure to make comment counts reflect "real" content
|
||||||
if (posting_to_submission and not rts and not c.slots_result):
|
if (posting_to_post and not rts and not c.slots_result):
|
||||||
post_target.comment_count += 1
|
post_target.comment_count += 1
|
||||||
g.db.add(post_target)
|
g.db.add(post_target)
|
||||||
|
|
||||||
|
@ -395,8 +395,8 @@ def comment(v:User):
|
||||||
|
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
if SITE == 'watchpeopledie.tv' and c.parent_submission:
|
if SITE == 'watchpeopledie.tv' and c.parent_post:
|
||||||
cache.delete(f'post_{c.parent_submission}')
|
cache.delete(f'post_{c.parent_post}')
|
||||||
|
|
||||||
if v.client: return c.json
|
if v.client: return c.json
|
||||||
return {"comment": render_template("comments.html", v=v, comments=[c])}
|
return {"comment": render_template("comments.html", v=v, comments=[c])}
|
||||||
|
@ -418,7 +418,7 @@ def delete_comment(cid, v):
|
||||||
|
|
||||||
v.comment_count = g.db.query(Comment).filter(
|
v.comment_count = g.db.query(Comment).filter(
|
||||||
Comment.author_id == v.id,
|
Comment.author_id == v.id,
|
||||||
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
or_(Comment.parent_post != None, Comment.wall_user_id != None),
|
||||||
Comment.deleted_utc == 0
|
Comment.deleted_utc == 0
|
||||||
).count()
|
).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -439,7 +439,7 @@ def undelete_comment(cid, v):
|
||||||
cache.delete_memoized(comment_idlist)
|
cache.delete_memoized(comment_idlist)
|
||||||
v.comment_count = g.db.query(Comment).filter(
|
v.comment_count = g.db.query(Comment).filter(
|
||||||
Comment.author_id == v.id,
|
Comment.author_id == v.id,
|
||||||
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
or_(Comment.parent_post != None, Comment.wall_user_id != None),
|
||||||
Comment.deleted_utc == 0
|
Comment.deleted_utc == 0
|
||||||
).count()
|
).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -607,7 +607,7 @@ def edit_comment(cid, v):
|
||||||
abort(403, "You can't edit comments older than 1 week!")
|
abort(403, "You can't edit comments older than 1 week!")
|
||||||
|
|
||||||
if c.author_id != v.id: abort(403)
|
if c.author_id != v.id: abort(403)
|
||||||
if not c.parent_submission and not c.wall_user_id:
|
if not c.parent_post and not c.wall_user_id:
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
body = sanitize_raw_body(request.values.get("body", ""), False)
|
body = sanitize_raw_body(request.values.get("body", ""), False)
|
||||||
|
|
|
@ -189,7 +189,7 @@ def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0):
|
||||||
.outerjoin(Comment.post) \
|
.outerjoin(Comment.post) \
|
||||||
.options(load_only(Comment.id)) \
|
.options(load_only(Comment.id)) \
|
||||||
.filter(
|
.filter(
|
||||||
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
or_(Comment.parent_post != None, Comment.wall_user_id != None),
|
||||||
)
|
)
|
||||||
|
|
||||||
if v.admin_level < PERMS['POST_COMMENT_MODERATION']:
|
if v.admin_level < PERMS['POST_COMMENT_MODERATION']:
|
||||||
|
@ -197,7 +197,7 @@ def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0):
|
||||||
Comment.is_banned == False,
|
Comment.is_banned == False,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.author_id.notin_(v.userblocks),
|
Comment.author_id.notin_(v.userblocks),
|
||||||
or_(Comment.parent_submission == None, Post.private == False),
|
or_(Comment.parent_post == None, Post.private == False),
|
||||||
)
|
)
|
||||||
|
|
||||||
if gt: comments = comments.filter(Comment.created_utc > gt)
|
if gt: comments = comments.filter(Comment.created_utc > gt)
|
||||||
|
|
|
@ -96,7 +96,7 @@ def notifications_messages(v:User):
|
||||||
message_threads = g.db.query(Comment).filter(
|
message_threads = g.db.query(Comment).filter(
|
||||||
Comment.sentto != None,
|
Comment.sentto != None,
|
||||||
or_(Comment.author_id == v.id, Comment.sentto == v.id),
|
or_(Comment.author_id == v.id, Comment.sentto == v.id),
|
||||||
Comment.parent_submission == None,
|
Comment.parent_post == None,
|
||||||
Comment.level == 1,
|
Comment.level == 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ def notifications_reddit(v:User):
|
||||||
|
|
||||||
listing = g.db.query(Comment).filter(
|
listing = g.db.query(Comment).filter(
|
||||||
Comment.body_html.like('%<p>New site mention%<a href="https://old.reddit.com/r/%'),
|
Comment.body_html.like('%<p>New site mention%<a href="https://old.reddit.com/r/%'),
|
||||||
Comment.parent_submission == None,
|
Comment.parent_post == None,
|
||||||
Comment.author_id == AUTOJANNY_ID
|
Comment.author_id == AUTOJANNY_ID
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ def notifications(v:User):
|
||||||
|
|
||||||
if not n.read: c.unread = True
|
if not n.read: c.unread = True
|
||||||
|
|
||||||
if c.parent_submission or c.wall_user_id:
|
if c.parent_post or c.wall_user_id:
|
||||||
all_items.append(c)
|
all_items.append(c)
|
||||||
|
|
||||||
if c.replies2 == None:
|
if c.replies2 == None:
|
||||||
|
|
|
@ -73,7 +73,7 @@ def request_api_keys(v):
|
||||||
body_html = sanitize(body, blackjack="app description")
|
body_html = sanitize(body, blackjack="app description")
|
||||||
|
|
||||||
new_comment = Comment(author_id=AUTOJANNY_ID,
|
new_comment = Comment(author_id=AUTOJANNY_ID,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
level=1,
|
level=1,
|
||||||
body_html=body_html,
|
body_html=body_html,
|
||||||
sentto=MODMAIL_ID,
|
sentto=MODMAIL_ID,
|
||||||
|
|
|
@ -70,7 +70,7 @@ def vote_option_comment(option_id, v):
|
||||||
option = g.db.get(CommentOption, option_id)
|
option = g.db.get(CommentOption, option_id)
|
||||||
if not option: abort(404)
|
if not option: abort(404)
|
||||||
|
|
||||||
if option.parent.parent_submission:
|
if option.parent.parent_post:
|
||||||
sub = option.parent.post.sub
|
sub = option.parent.post.sub
|
||||||
else:
|
else:
|
||||||
sub = None
|
sub = None
|
||||||
|
|
|
@ -109,7 +109,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
execute_shadowban_viewers_and_voters(v, p)
|
execute_shadowban_viewers_and_voters(v, p)
|
||||||
# shadowban check is done in sort_objects
|
# shadowban check is done in sort_objects
|
||||||
# output is needed: see comments.py
|
# output is needed: see comments.py
|
||||||
comments, output = get_comments_v_properties(v, None, Comment.parent_submission == p.id, Comment.level < 10)
|
comments, output = get_comments_v_properties(v, None, Comment.parent_post == p.id, Comment.level < 10)
|
||||||
|
|
||||||
if sort == "hot":
|
if sort == "hot":
|
||||||
pinned = [c[0] for c in comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all()]
|
pinned = [c[0] for c in comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all()]
|
||||||
|
@ -119,7 +119,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
comments = sort_objects(sort, comments, Comment)
|
comments = sort_objects(sort, comments, Comment)
|
||||||
comments = [c[0] for c in comments.all()]
|
comments = [c[0] for c in comments.all()]
|
||||||
else:
|
else:
|
||||||
comments = g.db.query(Comment).filter(Comment.parent_submission == p.id)
|
comments = g.db.query(Comment).filter(Comment.parent_post == p.id)
|
||||||
|
|
||||||
if sort == "hot":
|
if sort == "hot":
|
||||||
pinned = comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all()
|
pinned = comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all()
|
||||||
|
@ -141,13 +141,13 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
for comment in comments:
|
for comment in comments:
|
||||||
comments2.append(comment)
|
comments2.append(comment)
|
||||||
ids.add(comment.id)
|
ids.add(comment.id)
|
||||||
count += g.db.query(Comment).filter_by(parent_submission=p.id, top_comment_id=comment.id).count() + 1
|
count += g.db.query(Comment).filter_by(parent_post=p.id, top_comment_id=comment.id).count() + 1
|
||||||
if count > threshold: break
|
if count > threshold: break
|
||||||
else:
|
else:
|
||||||
for comment in comments:
|
for comment in comments:
|
||||||
comments2.append(comment)
|
comments2.append(comment)
|
||||||
ids.add(comment.id)
|
ids.add(comment.id)
|
||||||
count += g.db.query(Comment).filter_by(parent_submission=p.id, parent_comment_id=comment.id).count() + 1
|
count += g.db.query(Comment).filter_by(parent_post=p.id, parent_comment_id=comment.id).count() + 1
|
||||||
if count > 20: break
|
if count > 20: break
|
||||||
|
|
||||||
if len(comments) == len(comments2): offset = 0
|
if len(comments) == len(comments2): offset = 0
|
||||||
|
@ -203,14 +203,14 @@ def view_more(v, pid, sort, offset):
|
||||||
if v:
|
if v:
|
||||||
# shadowban check is done in sort_objects
|
# shadowban check is done in sort_objects
|
||||||
# output is needed: see comments.py
|
# output is needed: see comments.py
|
||||||
comments, output = get_comments_v_properties(v, None, Comment.parent_submission == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10)
|
comments, output = get_comments_v_properties(v, None, Comment.parent_post == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10)
|
||||||
comments = comments.filter(Comment.level == 1)
|
comments = comments.filter(Comment.level == 1)
|
||||||
comments = sort_objects(sort, comments, Comment)
|
comments = sort_objects(sort, comments, Comment)
|
||||||
|
|
||||||
comments = [c[0] for c in comments.all()]
|
comments = [c[0] for c in comments.all()]
|
||||||
else:
|
else:
|
||||||
comments = g.db.query(Comment).filter(
|
comments = g.db.query(Comment).filter(
|
||||||
Comment.parent_submission == pid,
|
Comment.parent_post == pid,
|
||||||
Comment.level == 1,
|
Comment.level == 1,
|
||||||
Comment.stickied == None,
|
Comment.stickied == None,
|
||||||
Comment.id.notin_(ids)
|
Comment.id.notin_(ids)
|
||||||
|
@ -226,13 +226,13 @@ def view_more(v, pid, sort, offset):
|
||||||
for comment in comments:
|
for comment in comments:
|
||||||
comments2.append(comment)
|
comments2.append(comment)
|
||||||
ids.add(comment.id)
|
ids.add(comment.id)
|
||||||
count += g.db.query(Comment).filter_by(parent_submission=p.id, top_comment_id=comment.id).count() + 1
|
count += g.db.query(Comment).filter_by(parent_post=p.id, top_comment_id=comment.id).count() + 1
|
||||||
if count > 100: break
|
if count > 100: break
|
||||||
else:
|
else:
|
||||||
for comment in comments:
|
for comment in comments:
|
||||||
comments2.append(comment)
|
comments2.append(comment)
|
||||||
ids.add(comment.id)
|
ids.add(comment.id)
|
||||||
count += g.db.query(Comment).filter_by(parent_submission=p.id, parent_comment_id=comment.id).count() + 1
|
count += g.db.query(Comment).filter_by(parent_post=p.id, parent_comment_id=comment.id).count() + 1
|
||||||
if count > 20: break
|
if count > 20: break
|
||||||
|
|
||||||
if len(comments) == len(comments2): offset = 0
|
if len(comments) == len(comments2): offset = 0
|
||||||
|
@ -565,7 +565,7 @@ def submit_post(v:User, sub=None):
|
||||||
if dup:
|
if dup:
|
||||||
return {"post_id": dup.id, "success": False}
|
return {"post_id": dup.id, "success": False}
|
||||||
|
|
||||||
if not execute_antispam_submission_check(title, v, url):
|
if not execute_antispam_post_check(title, v, url):
|
||||||
return redirect("/notifications")
|
return redirect("/notifications")
|
||||||
|
|
||||||
if len(url) > 2048:
|
if len(url) > 2048:
|
||||||
|
@ -684,7 +684,7 @@ def submit_post(v:User, sub=None):
|
||||||
|
|
||||||
|
|
||||||
c_jannied = Comment(author_id=AUTOJANNY_ID,
|
c_jannied = Comment(author_id=AUTOJANNY_ID,
|
||||||
parent_submission=p.id,
|
parent_post=p.id,
|
||||||
level=1,
|
level=1,
|
||||||
over_18=False,
|
over_18=False,
|
||||||
is_bot=True,
|
is_bot=True,
|
||||||
|
|
|
@ -199,7 +199,7 @@ def searchcomments(v:User):
|
||||||
|
|
||||||
comments = g.db.query(Comment).options(load_only(Comment.id)).outerjoin(Comment.post) \
|
comments = g.db.query(Comment).options(load_only(Comment.id)).outerjoin(Comment.post) \
|
||||||
.filter(
|
.filter(
|
||||||
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
or_(Comment.parent_post != None, Comment.wall_user_id != None),
|
||||||
Comment.author_id.notin_(v.userblocks),
|
Comment.author_id.notin_(v.userblocks),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ def searchcomments(v:User):
|
||||||
if 'post' in criteria:
|
if 'post' in criteria:
|
||||||
try: post = int(criteria['post'])
|
try: post = int(criteria['post'])
|
||||||
except: abort(404)
|
except: abort(404)
|
||||||
comments = comments.filter(Comment.parent_submission == post)
|
comments = comments.filter(Comment.parent_post == post)
|
||||||
|
|
||||||
|
|
||||||
if 'author' in criteria:
|
if 'author' in criteria:
|
||||||
|
@ -245,7 +245,7 @@ def searchcomments(v:User):
|
||||||
Comment.is_banned==False,
|
Comment.is_banned==False,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
or_(
|
or_(
|
||||||
Comment.parent_submission.notin_(private),
|
Comment.parent_post.notin_(private),
|
||||||
Comment.wall_user_id != None
|
Comment.wall_user_id != None
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -307,7 +307,7 @@ def searchmessages(v:User):
|
||||||
comments = g.db.query(Comment).options(load_only(Comment.id)) \
|
comments = g.db.query(Comment).options(load_only(Comment.id)) \
|
||||||
.filter(
|
.filter(
|
||||||
Comment.sentto != None,
|
Comment.sentto != None,
|
||||||
Comment.parent_submission == None,
|
Comment.parent_post == None,
|
||||||
or_(*dm_conditions),
|
or_(*dm_conditions),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ def submit_contact(v):
|
||||||
execute_antispam_duplicate_comment_check(v, body_html)
|
execute_antispam_duplicate_comment_check(v, body_html)
|
||||||
|
|
||||||
new_comment = Comment(author_id=v.id,
|
new_comment = Comment(author_id=v.id,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
level=1,
|
level=1,
|
||||||
body=body,
|
body=body,
|
||||||
body_html=body_html,
|
body_html=body_html,
|
||||||
|
@ -386,7 +386,7 @@ def transfers_id(id, v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def transfers(v:User):
|
def transfers(v:User):
|
||||||
|
|
||||||
comments = g.db.query(Comment).filter(Comment.author_id == AUTOJANNY_ID, Comment.parent_submission == None, Comment.body_html.like("%</a> has transferred %"))
|
comments = g.db.query(Comment).filter(Comment.author_id == AUTOJANNY_ID, Comment.parent_post == None, Comment.body_html.like("%</a> has transferred %"))
|
||||||
|
|
||||||
page = get_page()
|
page = get_page()
|
||||||
|
|
||||||
|
|
|
@ -561,7 +561,7 @@ def message2(v:User, username:str):
|
||||||
if existing: abort(403, "Message already exists!")
|
if existing: abort(403, "Message already exists!")
|
||||||
|
|
||||||
c = Comment(author_id=v.id,
|
c = Comment(author_id=v.id,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
level=1,
|
level=1,
|
||||||
sentto=user.id,
|
sentto=user.id,
|
||||||
body=body,
|
body=body,
|
||||||
|
@ -638,7 +638,7 @@ def messagereply(v:User):
|
||||||
sentto = user_id
|
sentto = user_id
|
||||||
|
|
||||||
c = Comment(author_id=v.id,
|
c = Comment(author_id=v.id,
|
||||||
parent_submission=None,
|
parent_post=None,
|
||||||
parent_comment_id=id,
|
parent_comment_id=id,
|
||||||
top_comment_id=parent.top_comment_id,
|
top_comment_id=parent.top_comment_id,
|
||||||
level=parent.level + 1,
|
level=parent.level + 1,
|
||||||
|
@ -1036,7 +1036,7 @@ def u_username_comments(username, v=None):
|
||||||
.outerjoin(comment_post_author, Post.author) \
|
.outerjoin(comment_post_author, Post.author) \
|
||||||
.filter(
|
.filter(
|
||||||
Comment.author_id == u.id,
|
Comment.author_id == u.id,
|
||||||
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
or_(Comment.parent_post != None, Comment.wall_user_id != None),
|
||||||
)
|
)
|
||||||
|
|
||||||
if not v or (v.id != u.id and v.admin_level < PERMS['POST_COMMENT_MODERATION']):
|
if not v or (v.id != u.id and v.admin_level < PERMS['POST_COMMENT_MODERATION']):
|
||||||
|
|
|
@ -60,7 +60,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
||||||
target = get_post(target_id)
|
target = get_post(target_id)
|
||||||
elif cls == Comment:
|
elif cls == Comment:
|
||||||
target = get_comment(target_id)
|
target = get_comment(target_id)
|
||||||
if not target.parent_submission and not target.wall_user_id: abort(404)
|
if not target.parent_post and not target.wall_user_id: abort(404)
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
|
|
@ -68,16 +68,16 @@
|
||||||
|
|
||||||
{% if standalone and level==1 %}
|
{% if standalone and level==1 %}
|
||||||
<div id="post-info-{{c.id}}" class="post-info mb-1 mr-2 {% if request.path.startswith('/notifications') %}mt-5{% elif request.path == '/search/messages' %}mt-6{% else %}mt-3{% endif %}">
|
<div id="post-info-{{c.id}}" class="post-info mb-1 mr-2 {% if request.path.startswith('/notifications') %}mt-5{% elif request.path == '/search/messages' %}mt-6{% else %}mt-3{% endif %}">
|
||||||
{% if c.parent_submission and c.post.over_18 %}
|
{% if c.parent_post and c.post.over_18 %}
|
||||||
<span class="badge badge-danger text-small-extra mr-1">+18</span>
|
<span class="badge badge-danger text-small-extra mr-1">+18</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="align-top">
|
<span class="align-top">
|
||||||
{% if c.parent_submission %}
|
{% if c.parent_post %}
|
||||||
{% if c.author_id==v.id and replies and is_notification_page %}
|
{% if c.author_id==v.id and replies and is_notification_page %}
|
||||||
<span class="font-weight-bold">Comment {{'Replies' if (replies | length)>1 else 'Reply'}}: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
<span class="font-weight-bold">Comment {{'Replies' if (replies | length)>1 else 'Reply'}}: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
||||||
{% elif c.post.author_id==v.id and c.level == 1 and is_notification_page%}
|
{% elif c.post.author_id==v.id and c.level == 1 and is_notification_page%}
|
||||||
<span class="font-weight-bold">Post Reply: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
<span class="font-weight-bold">Post Reply: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
||||||
{% elif is_notification_page and c.parent_submission in v.subscribed_idlist %}
|
{% elif is_notification_page and c.parent_post in v.subscribed_idlist %}
|
||||||
<span class="font-weight-bold">Subscribed Thread: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
<span class="font-weight-bold">Subscribed Thread: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
||||||
{% elif is_notification_page %}
|
{% elif is_notification_page %}
|
||||||
<span class="font-weight-bold">Username Mention: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
<span class="font-weight-bold">Username Mention: <a href="{{c.post.permalink}}">{{c.post.realtitle(v) | safe}}</a></span>
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if c.parent_submission %}
|
{% if c.parent_post %}
|
||||||
{% set sub = c.post.sub %}
|
{% set sub = c.post.sub %}
|
||||||
{% if sub and c.author.exiled_from(sub) %}
|
{% if sub and c.author.exiled_from(sub) %}
|
||||||
<a><i class="fas fa-campfire text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User has been exiled from /h/{{sub}}"></i></a>
|
<a><i class="fas fa-campfire text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User has been exiled from /h/{{sub}}"></i></a>
|
||||||
|
@ -245,7 +245,7 @@
|
||||||
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.chudded %}text-uppercase chud-img chud-{{c.id_last_num}}{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %} {%if c.author.queen%}queen{%endif%}">
|
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.chudded %}text-uppercase chud-img chud-{{c.id_last_num}}{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %} {%if c.author.queen%}queen{%endif%}">
|
||||||
{{realbody | safe}}
|
{{realbody | safe}}
|
||||||
</div>
|
</div>
|
||||||
{% if c.parent_submission or c.wall_user_id %}
|
{% if c.parent_post or c.wall_user_id %}
|
||||||
|
|
||||||
{% if v and v.id==c.author_id %}
|
{% if v and v.id==c.author_id %}
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@
|
||||||
<button type="button" id="save-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id not in v.saved_comment_idlist %}d-md-inline-block{% endif %} text-muted d-none" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/save_comment/{{c.id}}','save-{{c.id}}','unsave-{{c.id}}','d-md-inline-block')"><i class="fas fa-save"></i>Save {% if c.num_savers %}<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="Number of users who saved this comment">[{{c.num_savers}}]</span>{% endif %}</button>
|
<button type="button" id="save-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id not in v.saved_comment_idlist %}d-md-inline-block{% endif %} text-muted d-none" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/save_comment/{{c.id}}','save-{{c.id}}','unsave-{{c.id}}','d-md-inline-block')"><i class="fas fa-save"></i>Save {% if c.num_savers %}<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="Number of users who saved this comment">[{{c.num_savers}}]</span>{% endif %}</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if c.parent_submission or c.wall_user_id %}
|
{% if c.parent_post or c.wall_user_id %}
|
||||||
{% if v and c.author_id == v.id %}
|
{% if v and c.author_id == v.id %}
|
||||||
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-nonce="{{g.nonce}}" data-onclick="toggleEdit('{{c.id}}')"><i class="fas fa-edit fa-fw"></i>Edit</button>
|
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-nonce="{{g.nonce}}" data-onclick="toggleEdit('{{c.id}}')"><i class="fas fa-edit fa-fw"></i>Edit</button>
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@
|
||||||
<button type="button" id="block-{{c.id}}" class="dropdown-item list-inline-item text-danger {% if c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/block?username={{c.author_name}}','block-{{c.id}}','unblock-{{c.id}}','d-none')"><i class="fas fa-eye-slash text-danger"></i>Block user</button>
|
<button type="button" id="block-{{c.id}}" class="dropdown-item list-inline-item text-danger {% if c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/block?username={{c.author_name}}','block-{{c.id}}','unblock-{{c.id}}','d-none')"><i class="fas fa-eye-slash text-danger"></i>Block user</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if c.parent_submission %}
|
{% if c.parent_post %}
|
||||||
{% set url = "" %}
|
{% set url = "" %}
|
||||||
|
|
||||||
{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
|
{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
|
||||||
|
@ -449,7 +449,7 @@
|
||||||
<button type="button" id="remove-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.is_banned %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="removeComment(this,'{{c.id}}','approve-{{c.id}}','remove-{{c.id}}','d-md-block')"><i class="fas fa-ban text-danger fa-fw"></i>Remove</button>
|
<button type="button" id="remove-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.is_banned %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="removeComment(this,'{{c.id}}','approve-{{c.id}}','remove-{{c.id}}','d-md-block')"><i class="fas fa-ban text-danger fa-fw"></i>Remove</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if c.parent_submission %}
|
{% if c.parent_post %}
|
||||||
{% set sub = c.post.sub %}
|
{% set sub = c.post.sub %}
|
||||||
{% if sub and v.mods(sub) and not c.author.mods(sub) %}
|
{% if sub and v.mods(sub) and not c.author.mods(sub) %}
|
||||||
<button type="button" id="exile-{{c.id}}" class="d-none {% if not c.author.exiled_from(sub) %}d-md-block{% endif %} dropdown-item list-inline-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/exile/comment/{{c.id}}','exile-{{c.id}}','unexile-{{c.id}}','d-none')"><i class="fas fa-campfire text-danger fa-fw"></i>Exile user</button>
|
<button type="button" id="exile-{{c.id}}" class="d-none {% if not c.author.exiled_from(sub) %}d-md-block{% endif %} dropdown-item list-inline-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/exile/comment/{{c.id}}','exile-{{c.id}}','unexile-{{c.id}}','d-none')"><i class="fas fa-campfire text-danger fa-fw"></i>Exile user</button>
|
||||||
|
@ -462,7 +462,7 @@
|
||||||
<button type="button" id="unprogstack-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.is_approved == PROGSTACK_ID %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/unprogstack/comment/{{c.id}}','progstack-{{c.id}}','unprogstack-{{c.id}}','d-md-block')"><i class="fas fa-bullhorn text-danger fa-fw"></i>Remove Progressive Stack</button>
|
<button type="button" id="unprogstack-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.is_approved == PROGSTACK_ID %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/unprogstack/comment/{{c.id}}','progstack-{{c.id}}','unprogstack-{{c.id}}','d-md-block')"><i class="fas fa-bullhorn text-danger fa-fw"></i>Remove Progressive Stack</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if FEATURES['NSFW_MARKING'] and (c.parent_submission or c.wall_user_id) and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.sub and v.mods(c.post.sub))) %}
|
{% if FEATURES['NSFW_MARKING'] and (c.parent_post or c.wall_user_id) and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.sub and v.mods(c.post.sub))) %}
|
||||||
<button type="button" id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.over_18 %}d-md-block{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-success fa-fw"></i>Unmark +18</button>
|
<button type="button" id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.over_18 %}d-md-block{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-success fa-fw"></i>Unmark +18</button>
|
||||||
<button type="button" id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.over_18 %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark +18</button>
|
<button type="button" id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.over_18 %}d-md-block{% endif %} text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark +18</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -491,7 +491,7 @@
|
||||||
<div autocomplete="off" class="markdown d-none border my-2 p-3 rounded" id="markdown-{{c.fullname}}" readonly>{{c.body.strip()}}</div>
|
<div autocomplete="off" class="markdown d-none border my-2 p-3 rounded" id="markdown-{{c.fullname}}" readonly>{{c.body.strip()}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if c.parent_submission or c.wall_user_id %}
|
{% if c.parent_post or c.wall_user_id %}
|
||||||
{{macros.comment_reply_box(c.fullname, "reply-to-" + c.fullname, "d-none", "collapsed child", 'reply-to-' + c.fullname, true)}}
|
{{macros.comment_reply_box(c.fullname, "reply-to-" + c.fullname, "d-none", "collapsed child", 'reply-to-' + c.fullname, true)}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@
|
||||||
<div id="replies-of-{{c.fullname}}">
|
<div id="replies-of-{{c.fullname}}">
|
||||||
{% if request.path.startswith('/notifications') and replies|length > 8 %}
|
{% if request.path.startswith('/notifications') and replies|length > 8 %}
|
||||||
{% for reply in replies %}
|
{% for reply in replies %}
|
||||||
{% if reply.parent_submission %}
|
{% if reply.parent_post %}
|
||||||
{% set collapse = reply.collapse %}
|
{% set collapse = reply.collapse %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set collapse = not reply.unread and loop.index != replies|length %}
|
{% set collapse = not reply.unread and loop.index != replies|length %}
|
||||||
|
@ -521,7 +521,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %}
|
{% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_post and c.author_id != AUTOJANNY_ID %}
|
||||||
{% if (v and v.admin_level >= PERMS['USER_BAN']) and (c.sentto == MODMAIL_ID) %}
|
{% if (v and v.admin_level >= PERMS['USER_BAN']) and (c.sentto == MODMAIL_ID) %}
|
||||||
<button type="button" class="btn btn-danger mt-2 mr-3 {% if c.author.is_muted %}d-none{% endif %}" id="mute-user-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mute_user/{{c.author.id}}','mute-user-{{c.id}}','unmute-user-{{c.id}}','d-none')">Mute</button>
|
<button type="button" class="btn btn-danger mt-2 mr-3 {% if c.author.is_muted %}d-none{% endif %}" id="mute-user-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/mute_user/{{c.author.id}}','mute-user-{{c.id}}','unmute-user-{{c.id}}','d-none')">Mute</button>
|
||||||
<button type="button" class="btn btn-primary mt-2 mr-3 {% if not c.author.is_muted %}d-none{% endif %}" id="unmute-user-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmute_user/{{c.author.id}}','mute-user-{{c.id}}','unmute-user-{{c.id}}','d-none')">Unmute</button>
|
<button type="button" class="btn btn-primary mt-2 mr-3 {% if not c.author.is_muted %}d-none{% endif %}" id="unmute-user-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmute_user/{{c.author.id}}','mute-user-{{c.id}}','unmute-user-{{c.id}}','d-none')">Unmute</button>
|
||||||
|
@ -616,7 +616,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.admin_level < PERMS['POST_COMMENT_MODERATION'] %}
|
{% if v.admin_level < PERMS['POST_COMMENT_MODERATION'] %}
|
||||||
{% if c.parent_submission and v.id == c.post.author_id %}
|
{% if c.parent_post and v.id == c.post.author_id %}
|
||||||
<button type="button" id="pin2-{{c.id}}" class="list-group-item {% if c.stickied %}d-none{% endif %} text-info" data-bs-target="#actionsModal-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</button>
|
<button type="button" id="pin2-{{c.id}}" class="list-group-item {% if c.stickied %}d-none{% endif %} text-info" data-bs-target="#actionsModal-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</button>
|
||||||
<button type="button" id="unpin2-{{c.id}}" class="list-group-item {% if not c.stickied %}d-none{% endif %} text-info" data-bs-target="#actionsModal-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unpin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</button>
|
<button type="button" id="unpin2-{{c.id}}" class="list-group-item {% if not c.stickied %}d-none{% endif %} text-info" data-bs-target="#actionsModal-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unpin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</button>
|
||||||
{% elif c.post.sub and v.mods(c.post.sub) %}
|
{% elif c.post.sub and v.mods(c.post.sub) %}
|
||||||
|
@ -625,7 +625,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if c.parent_submission %}
|
{% if c.parent_post %}
|
||||||
{% set sub = c.post.sub %}
|
{% set sub = c.post.sub %}
|
||||||
{% if sub and v.mods(sub) and not c.author.mods(sub) %}
|
{% if sub and v.mods(sub) and not c.author.mods(sub) %}
|
||||||
<button type="button" data-bs-dismiss="modal" id="exile2-{{c.id}}" class="{% if c.author.exiled_from(sub) %}d-none{% endif %} list-group-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/exile/comment/{{c.id}}','exile2-{{c.id}}','unexile2-{{c.id}}','d-none')"><i class="fas fa-campfire text-danger mr-2"></i>Exile user</button>
|
<button type="button" data-bs-dismiss="modal" id="exile2-{{c.id}}" class="{% if c.author.exiled_from(sub) %}d-none{% endif %} list-group-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/exile/comment/{{c.id}}','exile2-{{c.id}}','unexile2-{{c.id}}','d-none')"><i class="fas fa-campfire text-danger mr-2"></i>Exile user</button>
|
||||||
|
@ -656,7 +656,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ul class="list-group comment-actions">
|
<ul class="list-group comment-actions">
|
||||||
{% if c.parent_submission or c.wall_user_id %}
|
{% if c.parent_post or c.wall_user_id %}
|
||||||
{% if v.admin_level >= PERMS['APPS_MODERATION'] and c.oauth_app %}
|
{% if v.admin_level >= PERMS['APPS_MODERATION'] and c.oauth_app %}
|
||||||
<a href="{{c.oauth_app.permalink}}/comments" class="list-group-item text-info"><i class="fas fa-code text-info mr-2"></i>API App</a>
|
<a href="{{c.oauth_app.permalink}}/comments" class="list-group-item text-info"><i class="fas fa-code text-info mr-2"></i>API App</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
alter table comments rename column parent_submission to parent_post;
|
||||||
|
|
||||||
|
alter index fki_save_relationship_submission_fkey rename to fki_save_relationship_post_fkey;
|
||||||
|
alter index fki_submission_sub_fkey rename to fki_post_sub_fkey;
|
||||||
|
alter index fki_submissions_approver_fkey rename to fki_post_approver_fkey;
|
||||||
|
alter index option_submission rename to option_post;
|
||||||
|
|
||||||
|
alter table award_relationships rename constraint award_submission_fkey to award_post_fkey;
|
||||||
|
alter table comments rename constraint comment_parent_submission_fkey to comment_parent_post_fkey;
|
||||||
|
alter table modactions rename constraint modactions_submission_fkey to modactions_post_fkey;
|
||||||
|
alter table post_options rename constraint option_submission_fkey to option_post_fkey;
|
||||||
|
alter table save_relationship rename constraint save_relationship_submission_fkey to save_relationship_post_fkey;
|
||||||
|
alter table subactions rename constraint subactions_submission_fkey to subactions_post_fkey;
|
||||||
|
alter table subscriptions rename constraint subscription_submission_fkey to subscription_post_fkey;
|
||||||
|
alter table post_option_votes rename constraint vote_submission_fkey to vote_post_fkey;
|
||||||
|
alter table votes rename constraint vote_submission_key to vote_post_key;
|
Loading…
Reference in New Issue