cxvcvx
This commit is contained in:
parent
3d3aad7414
commit
2db66c6149
4 changed files with 24 additions and 27 deletions
|
@ -92,7 +92,7 @@ class ModAction(Base):
|
|||
if self.target_user: return f'<a href="{self.target_user.url}">{self.target_user.username}</a>'
|
||||
elif self.target_post:
|
||||
if self.target_post.club: return f'<a href="{self.target_post.permalink}">{CC} ONLY</a>'
|
||||
return f'<a href="{self.target_post.permalink}">{self.target_post.title.replace("<","").replace(">","")}</a>'
|
||||
return f'<a href="{self.target_post.permalink}">{self.target_post.title.replace("<","")}</a>'
|
||||
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}?context=9#context">comment</a>'
|
||||
|
||||
@property
|
||||
|
|
|
@ -110,7 +110,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
if u:
|
||||
sanitized = sanitized.replace(i.group(0), f'''<p><a href="/id/{u.id}"><img alt="@{u.username}'s profile picture" loading="lazy" src="/uid/{u.id}/pic" class="pp20">@{u.username}</a>''', 1)
|
||||
else:
|
||||
sanitized = re.sub('(^|\s|\n|<p>)\/?((r|u)\/\w{3,25})', r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">\2</a>', sanitized)
|
||||
sanitized = re.sub('(^|\s|\n|<p>)\/?((r|u)\/(\w|-){3,25})', r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">\2</a>', sanitized)
|
||||
|
||||
for i in re.finditer('(^|\s|\n|<p>)@((\w|-){1,25})', sanitized):
|
||||
u = get_user(i.group(2), graceful=True)
|
||||
|
@ -268,7 +268,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
|
||||
def filter_emojis_only(title):
|
||||
|
||||
title = title.replace('<','').replace('>','').replace("\n", "").replace("\r", "").replace("\t", "").strip()
|
||||
title = title.replace('<','').replace("\n", "").replace("\r", "").replace("\t", "").strip()
|
||||
|
||||
title = bleach.clean(title, tags=[])
|
||||
|
||||
|
|
|
@ -111,15 +111,15 @@ def downvoters(v, username):
|
|||
|
||||
@app.get("/@<username>/upvoting")
|
||||
@auth_required
|
||||
@cache.memoize(timeout=3600)
|
||||
def upvoting(v, username):
|
||||
id = get_user(username).id
|
||||
|
||||
votes = g.db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Vote.user_id==id).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
|
||||
|
||||
# votes2 = g.db.query(Comment.author_id, func.count(Comment.author_id)).join(CommentVote, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==1, CommentVote.user_id==id).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
||||
votes2 = g.db.query(Comment.author_id, func.count(Comment.author_id)).join(CommentVote, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==1, CommentVote.user_id==id).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
||||
|
||||
votes = Counter(dict(votes))
|
||||
# + Counter(dict(votes2))
|
||||
votes = Counter(dict(votes)) + Counter(dict(votes2))
|
||||
|
||||
users = g.db.query(User).filter(User.id.in_(votes.keys())).all()
|
||||
users2 = []
|
||||
|
@ -131,15 +131,15 @@ def upvoting(v, username):
|
|||
|
||||
@app.get("/@<username>/downvoting")
|
||||
@auth_required
|
||||
@cache.memoize(timeout=3600)
|
||||
def downvoting(v, username):
|
||||
id = get_user(username).id
|
||||
|
||||
votes = g.db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Vote.user_id==id).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
|
||||
|
||||
# votes2 = g.db.query(Comment.author_id, func.count(Comment.author_id)).join(CommentVote, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1, CommentVote.user_id==id).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
||||
votes2 = g.db.query(Comment.author_id, func.count(Comment.author_id)).join(CommentVote, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1, CommentVote.user_id==id).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
||||
|
||||
votes = Counter(dict(votes))
|
||||
# + Counter(dict(votes2))
|
||||
votes = Counter(dict(votes)) + Counter(dict(votes2))
|
||||
|
||||
users = g.db.query(User).filter(User.id.in_(votes.keys())).all()
|
||||
users2 = []
|
||||
|
@ -778,12 +778,9 @@ def u_username_comments(username, v=None):
|
|||
|
||||
if v and request.path.startswith('/logged_out'): v = None
|
||||
|
||||
|
||||
|
||||
user = get_user(username, v=v)
|
||||
|
||||
|
||||
if username != user.username: return redirect(f'/id/{user.id}/comments')
|
||||
if username != user.username: return redirect(f'/@{user.username}/comments')
|
||||
|
||||
u = user
|
||||
|
||||
|
|
|
@ -267,16 +267,16 @@
|
|||
<div class="text-small font-weight-bold mt-1" id="charcount-edit-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>
|
||||
|
||||
<div class="comment-format">
|
||||
<a class="btn btn-secondary format m-0" role="button"><i class="fas fa-bold" onclick="makeBold('comment-edit-body-{{c.id}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Bold"></i></a>
|
||||
<a class="btn btn-secondary format m-0" role="button" onclick="makeBold('comment-edit-body-{{c.id}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Bold"><i class="fas fa-bold"></i></a>
|
||||
|
||||
<a class="btn btn-secondary format m-0" role="button"><i class="fas fa-italic" onclick="makeItalics('comment-edit-body-{{c.id}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Italicize"></i></a>
|
||||
<a class="btn btn-secondary format m-0" role="button" onclick="makeItalics('comment-edit-body-{{c.id}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Italicize"><i class="fas fa-italic"></i></a>
|
||||
|
||||
<a class="btn btn-secondary format m-0" role="button"><i class="fas fa-quote-right" onclick="makeQuote('comment-edit-body-{{c.id}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Quote"></i></a>
|
||||
<a class="btn btn-secondary format m-0" role="button" onclick="makeQuote('comment-edit-body-{{c.id}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Quote"><i class="fas fa-quote-right"></i></a>
|
||||
|
||||
|
||||
<small class="btn btn-secondary format m-0"><span class="font-weight-bolder text-uppercase" aria-hidden="true" onclick="commentForm('comment-edit-body-{{c.id}}');getGif()" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add GIF">GIF</span></small>
|
||||
<small class="btn btn-secondary format m-0" aria-hidden="true" onclick="commentForm('comment-edit-body-{{c.id}}');getGif()" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add GIF"><span class="font-weight-bolder text-uppercase">GIF</span></small>
|
||||
|
||||
<small class="btn btn-secondary format m-0"><i class="fas fa-smile-beam" aria-hidden="true" onclick="loadEmojis('comment-edit-body-{{c.id}}')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add Emoji"></i></small>
|
||||
<small class="btn btn-secondary format m-0" aria-hidden="true" onclick="loadEmojis('comment-edit-body-{{c.id}}')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add Emoji"><i class="fas fa-smile-beam"></i></small>
|
||||
|
||||
|
||||
<label class="btn btn-secondary format m-0" for="file-edit-reply-{{c.id}}">
|
||||
|
@ -501,19 +501,19 @@
|
|||
<div class="text-small font-weight-bold mt-1" id="charcount-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>
|
||||
|
||||
<div class="comment-format" id="comment-format-bar-{{c.id}}">
|
||||
<a class="btn btn-secondary format m-0" role="button"><i class="fas fa-bold" onclick="makeBold('reply-form-body-{{c.fullname}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Bold"></i></a>
|
||||
<a class="btn btn-secondary format m-0" role="button" onclick="makeBold('reply-form-body-{{c.fullname}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Bold"><i class="fas fa-bold"></i></a>
|
||||
|
||||
<a class="btn btn-secondary format m-0" role="button"><i class="fas fa-italic" onclick="makeItalics('reply-form-body-{{c.fullname}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Italicize"></i></a>
|
||||
<a class="btn btn-secondary format m-0" role="button" onclick="makeItalics('reply-form-body-{{c.fullname}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Italicize"><i class="fas fa-italic"></i></a>
|
||||
|
||||
<a class="btn btn-secondary format m-0" role="button"><i class="fas fa-quote-right" onclick="makeQuote('reply-form-body-{{c.fullname}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Quote"></i></a>
|
||||
<a class="btn btn-secondary format m-0" role="button" onclick="makeQuote('reply-form-body-{{c.fullname}}')" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Quote"><i class="fas fa-quote-right"></i></a>
|
||||
|
||||
|
||||
<label class="btn btn-secondary format m-0" for="gif-reply-btn-{{c.fullname}}">
|
||||
<span id="gif-reply-btn-{{c.fullname}}" class="font-weight-bolder text-uppercase" onclick="commentForm('reply-form-body-{{c.fullname}}');getGif()" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add GIF">GIF</span>
|
||||
<label class="btn btn-secondary format m-0" for="gif-reply-btn-{{c.fullname}}" onclick="commentForm('reply-form-body-{{c.fullname}}');getGif()" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add GIF">
|
||||
<span id="gif-reply-btn-{{c.fullname}}" class="font-weight-bolder text-uppercase">GIF</span>
|
||||
</label>
|
||||
|
||||
<label class="btn btn-secondary format m-0" for="gif-reply-btn-{{c.fullname}}">
|
||||
<i id="emoji-reply-btn-{{c.fullname}}" class="fas fa-smile-beam" onclick="loadEmojis('reply-form-body-{{c.fullname}}')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add Emoji"></i>
|
||||
<label class="btn btn-secondary format m-0" for="gif-reply-btn-{{c.fullname}}" onclick="loadEmojis('reply-form-body-{{c.fullname}}')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add Emoji">
|
||||
<i id="emoji-reply-btn-{{c.fullname}}" class="fas fa-smile-beam"></i>
|
||||
</label>
|
||||
|
||||
<label class="btn btn-secondary format m-0" for="file-upload-reply-{{c.fullname}}">
|
||||
|
@ -540,8 +540,8 @@
|
|||
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<textarea autocomplete="off" minlength="1" maxlength="10000" name="body" form="reply-to-t3_{{c.id}}" data-id="{{c.id}}" class="comment-box form-control rounded" id="reply-form-body-{{c.id}}" aria-label="With textarea" rows="3" oninput="markdown('reply-form-body-{{c.id}}', 'message-reply-{{c.id}}')"></textarea>
|
||||
<div class="comment-format" id="comment-format-bar-{{c.id}}">
|
||||
<label class="btn btn-secondary format m-0" for="gif-reply-btn-{{c.id}}">
|
||||
<i id="emoji-reply-btn-{{c.id}}" class="fas fa-smile-beam" onclick="loadEmojis('reply-form-body-{{c.id}}')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add Emoji"></i>
|
||||
<label class="btn btn-secondary format m-0" for="gif-reply-btn-{{c.id}}" onclick="loadEmojis('reply-form-body-{{c.id}}')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Add Emoji">
|
||||
<i id="emoji-reply-btn-{{c.id}}" class="fas fa-smile-beam"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue