Aevann1 2022-07-13 17:20:10 +02:00
parent dde09890e1
commit f6bf7400c3
6 changed files with 47 additions and 19 deletions

View File

@ -231,6 +231,11 @@ class Comment(Base):
def permalink(self):
return f"{SITE_FULL}{self.shortlink}"
@property
@lazy
def log_link(self):
return f"{SITE_FULL}/transfers/{self.id}"
@property
@lazy
def morecomments(self):

View File

@ -105,7 +105,7 @@ class ModAction(Base):
@property
@lazy
def permalink(self):
return f"/log/{self.id}"
return f"{SITE_FULL}/log/{self.id}"
ACTIONTYPES = {
'agendaposter': {

View File

@ -296,21 +296,4 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", gt=0, lt=0,
comments = sort_comments(sort, comments)
comments = comments.offset(25 * (page - 1)).limit(26).all()
return [x[0] for x in comments]
@app.get("/transfers")
@auth_required
def transfers(v):
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()]}
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
comments = comments.offset(25 * (page - 1)).limit(26).all()
next_exists = len(comments) > 25
comments = comments[:25]
return render_template("transfers.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists)
return [x[0] for x in comments]

View File

@ -375,3 +375,32 @@ def settings_security(v):
def dismiss_mobile_tip():
session["tooltip_last_dismissed"] = int(time.time())
return "", 204
@app.get("/transfers/<id>")
@auth_required
def transfers_id(id, v):
try: id = int(id)
except: abort(404)
transfer = g.db.get(Comment, id)
if not transfer: abort(404)
return render_template("transfers.html", v=v, page=1, comments=[transfer], standalone=True, next_exists=False)
@app.get("/transfers")
@auth_required
def transfers(v):
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()]}
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
comments = comments.offset(25 * (page - 1)).limit(26).all()
next_exists = len(comments) > 25
comments = comments[:25]
return render_template("transfers.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists)

View File

@ -585,6 +585,9 @@
</div>
<a href="{{c.log_link}}"><i class="far fa-link ml-1 text-muted"></i></a>
<a role="button" class="copy-link" role="button" data-clipboard-text="{{c.log_link}}"><i class="far fa-copy ml-1 text-muted"></i></a>
{% if render_replies %}
{% if level<9 or request.path.startswith('/notifications') or request.headers.get("xhr") %}
<div id="replies-of-{{c.id}}">

View File

@ -37,4 +37,12 @@
{% endif %}
</ul>
</nav>
<div class="toast clipboard" id="toast-success" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body text-center">
<i class="fas fa-check-circle text-success mr-2"></i>Link copied to clipboard
</div>
</div>
<script src="/assets/js/clipboard.js?v=240"></script>
{% endblock %}