forked from MarseyWorld/MarseyWorld
do this https://stupidpol.site/h/countryclub/post/79285/tired-of-some-cute-twink-jannies/3194721?context=8#context (#53)
Co-authored-by: Aevann1 <randomname42029@gmail.com> Reviewed-on: rDrama/rDrama#53master
parent
e8f9d39bcf
commit
81267ef1c6
|
@ -143,6 +143,7 @@ function post_reply(id){
|
||||||
document.getElementById('reply-form-body-'+id).value = ''
|
document.getElementById('reply-form-body-'+id).value = ''
|
||||||
document.getElementById('message-reply-'+id).innerHTML = ''
|
document.getElementById('message-reply-'+id).innerHTML = ''
|
||||||
ToggleReplyBox('reply-message-'+id)
|
ToggleReplyBox('reply-message-'+id)
|
||||||
|
document.getElementById('file-upload').value = null;
|
||||||
} else {
|
} else {
|
||||||
showToast(false, getMessageFromJsonData(false, data));
|
showToast(false, getMessageFromJsonData(false, data));
|
||||||
}
|
}
|
||||||
|
@ -179,6 +180,7 @@ function comment_edit(id){
|
||||||
bs_trigger(commentForm);
|
bs_trigger(commentForm);
|
||||||
document.getElementById('filename-edit-reply-' + id).innerHTML = '<i class="fas fa-file"></i>';
|
document.getElementById('filename-edit-reply-' + id).innerHTML = '<i class="fas fa-file"></i>';
|
||||||
document.getElementById('comment-edit-body-' + id).value = data["body"];
|
document.getElementById('comment-edit-body-' + id).value = data["body"];
|
||||||
|
document.getElementById('file-edit-reply-'+id).value = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showToast(false, getMessageFromJsonData(false, data));
|
showToast(false, getMessageFromJsonData(false, data));
|
||||||
|
@ -239,6 +241,7 @@ function post_comment(fullname, wall_user_id, hide){
|
||||||
document.getElementById('form-preview-'+fullname).innerHTML = ''
|
document.getElementById('form-preview-'+fullname).innerHTML = ''
|
||||||
document.getElementById('charcount-'+fullname).innerHTML = ''
|
document.getElementById('charcount-'+fullname).innerHTML = ''
|
||||||
document.getElementById('filename-show-reply-' + fullname).innerHTML = '<i class="fas fa-file"></i>';
|
document.getElementById('filename-show-reply-' + fullname).innerHTML = '<i class="fas fa-file"></i>';
|
||||||
|
document.getElementById('file-upload-reply-'+fullname).value = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showToast(false, getMessageFromJsonData(false, data));
|
showToast(false, getMessageFromJsonData(false, data));
|
||||||
|
|
|
@ -292,7 +292,7 @@ function changename(s1,s2) {
|
||||||
if (files.length > 4)
|
if (files.length > 4)
|
||||||
{
|
{
|
||||||
alert("You can't upload more than 4 files at one time!")
|
alert("You can't upload more than 4 files at one time!")
|
||||||
document.getElementById(s2).files = null
|
document.getElementById(s2).value = null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let filename = '';
|
let filename = '';
|
||||||
|
|
|
@ -72,7 +72,7 @@ document.onpaste = function(event) {
|
||||||
for (const file of files)
|
for (const file of files)
|
||||||
filename += file.name + ', '
|
filename += file.name + ', '
|
||||||
filename = filename.toLowerCase().slice(0, -2)
|
filename = filename.toLowerCase().slice(0, -2)
|
||||||
document.getElementById('file-upload-submit').files = files;
|
document.getElementById('file-upload-submit').value = files;
|
||||||
document.getElementById('filename-show-submit').textContent = filename;
|
document.getElementById('filename-show-submit').textContent = filename;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -131,14 +131,12 @@ def get_post(i:Union[str, int], v:Optional[User]=None, graceful=False) -> Option
|
||||||
)
|
)
|
||||||
|
|
||||||
post=post.filter(Submission.id == i
|
post=post.filter(Submission.id == i
|
||||||
).join(
|
).outerjoin(
|
||||||
vt,
|
vt,
|
||||||
vt.c.submission_id == Submission.id,
|
vt.c.submission_id == Submission.id,
|
||||||
isouter=True
|
).outerjoin(
|
||||||
).join(
|
|
||||||
blocking,
|
blocking,
|
||||||
blocking.c.target_id == Submission.author_id,
|
blocking.c.target_id == Submission.author_id,
|
||||||
isouter=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
post=post.one_or_none()
|
post=post.one_or_none()
|
||||||
|
@ -179,16 +177,14 @@ def get_posts(pids:Iterable[int], v:Optional[User]=None, eager:bool=False, extra
|
||||||
blocked.c.target_id,
|
blocked.c.target_id,
|
||||||
).filter(
|
).filter(
|
||||||
Submission.id.in_(pids)
|
Submission.id.in_(pids)
|
||||||
).join(
|
).outerjoin(
|
||||||
vt, vt.c.submission_id==Submission.id, isouter=True
|
vt, vt.c.submission_id==Submission.id
|
||||||
).join(
|
).outerjoin(
|
||||||
blocking,
|
blocking,
|
||||||
blocking.c.target_id == Submission.author_id,
|
blocking.c.target_id == Submission.author_id,
|
||||||
isouter=True
|
).outerjoin(
|
||||||
).join(
|
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Submission.author_id,
|
blocked.c.user_id == Submission.author_id,
|
||||||
isouter=True
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
query = g.db.query(Submission).filter(Submission.id.in_(pids))
|
query = g.db.query(Submission).filter(Submission.id.in_(pids))
|
||||||
|
@ -320,18 +316,15 @@ def get_comments_v_properties(v:User, include_shadowbanned=True, should_keep_fun
|
||||||
comments = comments.join(Comment.author).filter(User.shadowbanned == None)
|
comments = comments.join(Comment.author).filter(User.shadowbanned == None)
|
||||||
|
|
||||||
comments = comments.filter(*criterion)
|
comments = comments.filter(*criterion)
|
||||||
comments = comments.join(
|
comments = comments.outerjoin(
|
||||||
votes,
|
votes,
|
||||||
votes.c.comment_id == Comment.id,
|
votes.c.comment_id == Comment.id,
|
||||||
isouter=True
|
).outerjoin(
|
||||||
).join(
|
|
||||||
blocking,
|
blocking,
|
||||||
blocking.c.target_id == Comment.author_id,
|
blocking.c.target_id == Comment.author_id,
|
||||||
isouter=True
|
).outerjoin(
|
||||||
).join(
|
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Comment.author_id,
|
blocked.c.user_id == Comment.author_id,
|
||||||
isouter=True
|
|
||||||
)
|
)
|
||||||
queried = comments.all()
|
queried = comments.all()
|
||||||
output = []
|
output = []
|
||||||
|
|
|
@ -79,7 +79,6 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
||||||
else: template = "submission.html"
|
else: template = "submission.html"
|
||||||
return render_template(template, v=v, p=post, sort=sort, comment_info=comment_info, render_replies=True, sub=post.subr)
|
return render_template(template, v=v, p=post, sort=sort, comment_info=comment_info, render_replies=True, sub=post.subr)
|
||||||
|
|
||||||
#- API
|
|
||||||
@app.post("/comment")
|
@app.post("/comment")
|
||||||
@limiter.limit("1/second;20/minute;200/hour;1000/day")
|
@limiter.limit("1/second;20/minute;200/hour;1000/day")
|
||||||
@auth_required
|
@auth_required
|
||||||
|
@ -311,7 +310,7 @@ def comment(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,
|
||||||
Comment.parent_submission != None,
|
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
||||||
Comment.deleted_utc == 0
|
Comment.deleted_utc == 0
|
||||||
).count()
|
).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -346,7 +345,6 @@ def comment(v):
|
||||||
return {"comment": render_template("comments.html", v=v, comments=[c])}
|
return {"comment": render_template("comments.html", v=v, comments=[c])}
|
||||||
|
|
||||||
|
|
||||||
#- API
|
|
||||||
@app.post("/wall_comment")
|
@app.post("/wall_comment")
|
||||||
@limiter.limit("1/second;20/minute;200/hour;1000/day")
|
@limiter.limit("1/second;20/minute;200/hour;1000/day")
|
||||||
@auth_required
|
@auth_required
|
||||||
|
@ -523,7 +521,7 @@ def wall_comment(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,
|
||||||
Comment.parent_submission != None,
|
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
||||||
Comment.deleted_utc == 0
|
Comment.deleted_utc == 0
|
||||||
).count()
|
).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -550,6 +548,8 @@ def wall_comment(v):
|
||||||
|
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
|
cache.delete_memoized(comment_idlist)
|
||||||
|
|
||||||
if v.client: return c.json(db=g.db)
|
if v.client: return c.json(db=g.db)
|
||||||
return {"comment": render_template("comments.html", v=v, comments=[c])}
|
return {"comment": render_template("comments.html", v=v, comments=[c])}
|
||||||
|
|
||||||
|
@ -644,7 +644,7 @@ def delete_comment(cid, v):
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
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,
|
||||||
Comment.parent_submission != None,
|
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
||||||
Comment.deleted_utc == 0
|
Comment.deleted_utc == 0
|
||||||
).count()
|
).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -664,7 +664,7 @@ def undelete_comment(cid, v):
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
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,
|
||||||
Comment.parent_submission != None,
|
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
||||||
Comment.deleted_utc == 0
|
Comment.deleted_utc == 0
|
||||||
).count()
|
).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
|
@ -210,8 +210,10 @@ def all_comments(v:User):
|
||||||
@cache.memoize(timeout=86400)
|
@cache.memoize(timeout=86400)
|
||||||
def comment_idlist(v=None, page=1, sort="new", t="all", gt=0, lt=0, site=None):
|
def comment_idlist(v=None, page=1, sort="new", t="all", gt=0, lt=0, site=None):
|
||||||
comments = g.db.query(Comment.id) \
|
comments = g.db.query(Comment.id) \
|
||||||
.join(Comment.post) \
|
.outerjoin(Comment.post) \
|
||||||
.filter(Comment.parent_submission != None)
|
.filter(
|
||||||
|
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
||||||
|
)
|
||||||
|
|
||||||
if v.admin_level < PERMS['POST_COMMENT_MODERATION']:
|
if v.admin_level < PERMS['POST_COMMENT_MODERATION']:
|
||||||
comments = comments.filter(
|
comments = comments.filter(
|
||||||
|
|
|
@ -181,8 +181,11 @@ def searchcomments(v:User):
|
||||||
|
|
||||||
criteria = searchparse(query)
|
criteria = searchparse(query)
|
||||||
|
|
||||||
comments = g.db.query(Comment.id).join(Comment.post) \
|
comments = g.db.query(Comment.id).outerjoin(Comment.post) \
|
||||||
.filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks))
|
.filter(
|
||||||
|
or_(Comment.parent_submission != None, Comment.wall_user_id != None),
|
||||||
|
Comment.author_id.notin_(v.userblocks),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if 'post' in criteria:
|
if 'post' in criteria:
|
||||||
|
|
|
@ -938,11 +938,11 @@ def u_username_comments(username, v=None):
|
||||||
|
|
||||||
comment_post_author = aliased(User)
|
comment_post_author = aliased(User)
|
||||||
comments = g.db.query(Comment.id) \
|
comments = g.db.query(Comment.id) \
|
||||||
.join(Comment.post) \
|
.outerjoin(Comment.post) \
|
||||||
.join(comment_post_author, Submission.author) \
|
.outerjoin(comment_post_author, Submission.author) \
|
||||||
.filter(
|
.filter(
|
||||||
Comment.author_id == u.id,
|
Comment.author_id == u.id,
|
||||||
Comment.parent_submission != None
|
or_(Comment.parent_submission != 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']):
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
{% elif c.author_id==AUTOJANNY_ID %}
|
{% elif c.author_id==AUTOJANNY_ID %}
|
||||||
<span class="font-weight-bold">Notification</span>
|
<span class="font-weight-bold">Notification</span>
|
||||||
{% elif c.wall_user_id %}
|
{% elif c.wall_user_id %}
|
||||||
{% if request.path == '/notifications' %}
|
{% if not wall %}
|
||||||
{% if c.wall_user_id == v.id %}
|
{% if c.wall_user_id == v.id %}
|
||||||
<span class="font-weight-bold"><a href="/@{{v.username}}">Your Profile Wall</a></span>
|
<span class="font-weight-bold"><a href="/@{{v.username}}">Your Profile Wall</a></span>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in New Issue