forked from MarseyWorld/MarseyWorld
edits -> old versions
parent
e584959cd7
commit
55f4c6c3f1
|
@ -171,7 +171,7 @@ PERMS = { # Minimum admin_level to perform action.
|
|||
'VIEW_ACTIVE_USERS': 1,
|
||||
'VIEW_ALT_VOTES': 1,
|
||||
'VIEW_LAST_ACTIVE': 1,
|
||||
'VIEW_EDITS': 1,
|
||||
'VIEW_OLD_VERSIONS': 1,
|
||||
'ENABLE_VOTE_BUTTONS_ON_USER_PAGE': 1,
|
||||
'NOTIFICATIONS_MODERATOR_ACTIONS': 1,
|
||||
'EXEMPT_FROM_IP_LOGGING': 1,
|
||||
|
|
|
@ -2232,18 +2232,18 @@ def unmark_effortpost(pid, v):
|
|||
|
||||
return {"message": "Post has been unmarked as an effortpost!"}
|
||||
|
||||
@app.get("/edits/<link>")
|
||||
@app.get("/old_versions/<link>")
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
def view_edits(v, link):
|
||||
def old_versions(v, link):
|
||||
try:
|
||||
if "p_" in link: obj = get_post(int(link.split("p_")[1]), v=v)
|
||||
elif "c_" in link: obj = get_comment(int(link.split("c_")[1]), v=v)
|
||||
else: abort(400)
|
||||
except: abort(400)
|
||||
|
||||
if v.id != obj.author_id and v.admin_level < PERMS['VIEW_EDITS']:
|
||||
if v.id != obj.author_id and v.admin_level < PERMS['VIEW_OLD_VERSIONS']:
|
||||
abort(403, "You can't view other people's edits!")
|
||||
|
||||
return render_template("edits.html", v=v, obj=obj)
|
||||
|
|
|
@ -233,8 +233,8 @@
|
|||
|
||||
<a class="vertical-align ml-1" href="{{c.permalink}}">#{{c.id}}</a>
|
||||
|
||||
{% if c.edited_utc and v and (v.id == c.author_id or v.admin_level >= PERMS['VIEW_EDITS']) %}
|
||||
<a href="/edits/{{c.fullname}}" class="font-italic" data-nonce="{{g.nonce}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-onmouseover="timestamp(this, '{{c.edited_utc}}')">
|
||||
{% if c.edited_utc and v and (v.id == c.author_id or v.admin_level >= PERMS['VIEW_OLD_VERSIONS']) %}
|
||||
<a href="/old_versions/{{c.fullname}}" class="font-italic" data-nonce="{{g.nonce}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-onmouseover="timestamp(this, '{{c.edited_utc}}')">
|
||||
Edited <span id="comment-edited_string-{{c.id}}">{{c.edited_string}}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "default.html" %}
|
||||
{% block pagetitle %}Edits on {{obj.shortlink}}{% endblock %}
|
||||
{% block pagetitle %}Old versions of {{obj.shortlink}}{% endblock %}
|
||||
{% block content %}
|
||||
<h2 class="my-4 py-md-2">Old versions of {{obj.textlink | safe}}</h2>
|
||||
<div class="overflow-x-auto">
|
||||
|
|
|
@ -125,8 +125,8 @@
|
|||
{% endif %}
|
||||
|
||||
{% if p.edited_utc %}
|
||||
{% if v and (v.id == p.author_id or v.admin_level >= PERMS['VIEW_EDITS']) %}
|
||||
<a href="/edits/{{p.fullname}}" class="ml-2 d-inline-block">Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" id="edited_timestamp-{{p.id}}" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{p.edited_utc}}')">{{p.edited_string}}</span></a>
|
||||
{% if v and (v.id == p.author_id or v.admin_level >= PERMS['VIEW_OLD_VERSIONS']) %}
|
||||
<a href="/old_versions/{{p.fullname}}" class="ml-2 d-inline-block">Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" id="edited_timestamp-{{p.id}}" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{p.edited_utc}}')">{{p.edited_string}}</span></a>
|
||||
{% else %}
|
||||
<span class="ml-2 d-inline-block">Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" id="edited_timestamp-{{p.id}}" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{p.edited_utc}}')">{{p.edited_string}}</span></span>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue