Make commenting the default (#646)
This commit is contained in:
parent
fb530268bf
commit
a3180fad2a
10 changed files with 61 additions and 125 deletions
|
@ -646,13 +646,12 @@ def visitors(v):
|
|||
return render_template("viewers.html", v=v, viewers=viewers)
|
||||
|
||||
|
||||
@app.get("/@<username>")
|
||||
@app.get("/@<username>/posts")
|
||||
@auth_desired
|
||||
def u_username(username, v=None):
|
||||
u = get_user(username, v=v, include_blocks=True)
|
||||
|
||||
if username != u.username:
|
||||
return redirect(SITE_FULL + request.full_path.replace(username, u.username)[:-1])
|
||||
if username != u.username: return redirect(f'/@{u.username}/posts')
|
||||
|
||||
if u.reserved:
|
||||
if request.headers.get("Authorization") or request.headers.get("xhr"): abort(403, f"That username is reserved for: {u.reserved}")
|
||||
|
@ -698,7 +697,7 @@ def u_username(username, v=None):
|
|||
|
||||
if u.unban_utc:
|
||||
if request.headers.get("Authorization"): {"data": [x.json for x in listing]}
|
||||
return render_template("userpage.html",
|
||||
return render_template("userpage_submissions.html",
|
||||
unban=u.unban_string,
|
||||
u=u,
|
||||
v=v,
|
||||
|
@ -712,7 +711,7 @@ def u_username(username, v=None):
|
|||
|
||||
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
||||
return render_template("userpage.html",
|
||||
return render_template("userpage_submissions.html",
|
||||
u=u,
|
||||
v=v,
|
||||
listing=listing,
|
||||
|
@ -723,12 +722,13 @@ def u_username(username, v=None):
|
|||
is_following=(v and u.has_follower(v)))
|
||||
|
||||
|
||||
@app.get("/@<username>/comments")
|
||||
@app.get("/@<username>/")
|
||||
@auth_desired
|
||||
def u_username_comments(username, v=None):
|
||||
user = get_user(username, v=v, include_blocks=True)
|
||||
|
||||
if username != user.username: return redirect(f'/@{user.username}/comments')
|
||||
if username != user.username:
|
||||
return redirect(SITE_FULL + request.full_path.replace(username, user.username)[:-1])
|
||||
u = user
|
||||
|
||||
if u.reserved:
|
||||
|
@ -935,13 +935,14 @@ def saved_posts(v, username):
|
|||
listing = get_posts(ids, v=v, eager=True)
|
||||
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
||||
return render_template("userpage.html",
|
||||
u=v,
|
||||
v=v,
|
||||
listing=listing,
|
||||
page=page,
|
||||
next_exists=next_exists,
|
||||
)
|
||||
return render_template(
|
||||
"userpage_submissions.html",
|
||||
u=v,
|
||||
v=v,
|
||||
listing=listing,
|
||||
page=page,
|
||||
next_exists=next_exists,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/@<username>/saved/comments")
|
||||
|
@ -959,13 +960,15 @@ def saved_comments(v, username):
|
|||
|
||||
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
||||
return render_template("userpage_comments.html",
|
||||
u=v,
|
||||
v=v,
|
||||
listing=listing,
|
||||
page=page,
|
||||
next_exists=next_exists,
|
||||
standalone=True)
|
||||
return render_template(
|
||||
"userpage_comments.html",
|
||||
u=v,
|
||||
v=v,
|
||||
listing=listing,
|
||||
page=page,
|
||||
next_exists=next_exists,
|
||||
standalone=True
|
||||
)
|
||||
|
||||
|
||||
@app.post("/fp/<fp>")
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
<h3>Content</h3>
|
||||
<ul>
|
||||
<li><a href="/admin/image_posts">Image Posts</a></li>
|
||||
<li><a href="/admin/reported/posts">Reported Posts/Comments</a></li>
|
||||
<li><a href="/admin/removed/posts">Removed Posts/Comments</a></li>
|
||||
<li><a href="/admin/reported/comments">Reported Comments/Posts</a></li>
|
||||
<li><a href="/admin/removed/comments">Removed Comments/Posts</a></li>
|
||||
</ul>
|
||||
|
||||
<h3>Filtering</h3>
|
||||
<ul>
|
||||
<li><a href="/admin/filtered/posts">Filtered Posts/Comments</a></li>
|
||||
<li><a href="/admin/filtered/comments">Filtered Comments/Posts</a></li>
|
||||
</ul>
|
||||
|
||||
<h3>Users</h3>
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
|
||||
<ul class="nav post-nav py-2">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/filtered/posts" %} active{% endif %}" href="/admin/filtered/posts">
|
||||
<div>Posts</div>
|
||||
<a class="nav-link {% if request.path=="/admin/filtered/comments" %} active{% endif %}" href="/admin/filtered/comments">
|
||||
<div>Comments</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/filtered/comments" %} active{% endif %}" href="/admin/filtered/comments">
|
||||
<div>Comments</div>
|
||||
<a class="nav-link {% if request.path=="/admin/filtered/posts" %} active{% endif %}" href="/admin/filtered/posts">
|
||||
<div>Posts</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
<ul class="nav post-nav py-2">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/removed/posts" %} active{% endif %}" href="/admin/removed/posts">
|
||||
<div>Posts</div>
|
||||
<a class="nav-link {% if request.path=="/admin/removed/comments" %} active{% endif %}" href="/admin/removed/comments">
|
||||
<div>Comments</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/removed/comments" %} active{% endif %}" href="/admin/removed/comments">
|
||||
<div>Comments</div>
|
||||
<a class="nav-link {% if request.path=="/admin/removed/posts" %} active{% endif %}" href="/admin/removed/posts">
|
||||
<div>Posts</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
<ul class="nav post-nav py-2">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/reported/posts" %} active{% endif %}" href="/admin/reported/posts">
|
||||
<div>Posts</div>
|
||||
<a class="nav-link {% if request.path=="/admin/reported/comments" %} active{% endif %}" href="/admin/reported/comments">
|
||||
<div>Comments</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/reported/comments" %} active{% endif %}" href="/admin/reported/comments">
|
||||
<div>Comments</div>
|
||||
<a class="nav-link {% if request.path=="/admin/reported/posts" %} active{% endif %}" href="/admin/reported/posts">
|
||||
<div>Posts</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</a>
|
||||
|
||||
<div class="flex-grow-1 d-fl d-none d-md-block {% if not v %}pad{% endif %}">
|
||||
<form id="searchform" class="form-inline search flex-nowrap mx-0 mx-lg-auto" {% if err %}style="margin-right:40rem!important"{% endif %} action="{% if request.path.startswith('/search') %}{{request.path}}{% else %}/search/posts/{% endif %}" method="get">
|
||||
<form id="searchform" class="form-inline search flex-nowrap mx-0 mx-lg-auto" {% if err %}style="margin-right:40rem!important"{% endif %} action="{% if request.path.startswith('/search') %}{{request.path}}{% else %}/search/comments/{% endif %}" method="get">
|
||||
<input autocomplete="off" class="form-control w-100" placeholder="Search" aria-label="Search" name="q" value="{{request.values.get('q', '')}}">
|
||||
<span class="input-group-append">
|
||||
<span class="input-group-text border-0 bg-transparent" style="margin-left: -2.5rem; cursor: pointer;" onclick="document.getElementById('searchform').submit()">
|
||||
|
|
|
@ -61,10 +61,10 @@
|
|||
<div class="flex-row box-shadow-bottom d-flex justify-content-center justify-content-md-between align-items-center">
|
||||
<ul class="nav settings-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if '/posts/' in request.path %} active{% endif %}" href="/search/posts/?sort={{sort}}&q={{query | urlencode}}&t={{t}}">Posts</a>
|
||||
<a class="nav-link{% if '/comments/' in request.path %} active{% endif %}" href="/search/comments/?sort={{sort}}&q={{query | urlencode}}&t={{t}}">Comments</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if '/comments/' in request.path %} active{% endif %}" href="/search/comments/?sort={{sort}}&q={{query | urlencode}}&t={{t}}">Comments</a>
|
||||
<a class="nav-link{% if '/posts/' in request.path %} active{% endif %}" href="/search/posts/?sort={{sort}}&q={{query | urlencode}}&t={{t}}">Posts</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if '/users/' in request.path %} active{% endif %}" href="/search/users/?sort={{sort}}&q={{query | urlencode}}&t={{t}}">Users</a>
|
||||
|
|
|
@ -520,23 +520,23 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% block userpage_nav %}
|
||||
<div id="profilecontent" class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="flex-row box-shadow-bottom d-flex justify-content-center justify-content-md-between align-items-center">
|
||||
<ul class="nav settings-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if not 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}">Posts <span class="count">({{u.post_count}})</span></a>
|
||||
<a class="nav-link {% if 'posts' not in request.path and not 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}">Comments <span class="count">({{u.comment_count}})</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/comments">Comments <span class="count">({{u.comment_count}})</span></a>
|
||||
<a class="nav-link {% if 'posts' in request.path and not 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/posts">Posts <span class="count">({{u.post_count}})</span></a>
|
||||
</li>
|
||||
{% if u.id == v.id %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/saved/posts">Saved Posts <span class="count">({{u.saved_count}})</span></a>
|
||||
<a class="nav-link {% if 'posts' not in request.path and 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/saved/comments">Saved Comments <span class="count">({{u.saved_comment_count}})</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/saved/comments">Saved Comments <span class="count">({{u.saved_comment_count}})</span></a>
|
||||
<a class="nav-link {% if 'posts' in request.path and 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/saved/posts">Saved Posts <span class="count">({{u.saved_count}})</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -575,18 +575,8 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}" style="margin-top: 10px;">
|
||||
|
||||
<div class="col">
|
||||
|
||||
<div class="posts">
|
||||
{% include "submission_listing.html" %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block userpage_content required %}{% endblock %}
|
||||
|
||||
{% if v %}
|
||||
<div id='tax' class="d-none">{% if v.patron or u.patron or v.alts_patron or u.alts_patron %}0{% else %}0.03{% endif %}</div>
|
||||
|
|
|
@ -1,67 +1,7 @@
|
|||
{% extends "userpage.html" %}
|
||||
{%- import 'component/sorting_time.html' as sorting_time -%}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="flex-row box-shadow-bottom d-flex justify-content-center justify-content-md-between align-items-center">
|
||||
<ul class="nav settings-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}">Posts <span class="count">({{u.post_count}})</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if not 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/comments">Comments <span class="count">({{u.comment_count}})</span></a>
|
||||
</li>
|
||||
{% if u.id == v.id %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/saved/posts">Saved Posts <span class="count">({{u.saved_count}})</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important" href="/@{{u.username}}/saved/comments">Saved Comments <span class="count">({{u.saved_comment_count}})</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if not "saved" in request.full_path %}
|
||||
<div class="d-flex justify-content-between align-items-center" style="padding-top:10px">
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="text-small font-weight-bold mr-2"></div>
|
||||
<div class="dropdown dropdown-actions">
|
||||
<button class="btn btn-secondary dropdown-toggle" role="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{% if t=="hour" %}<i class="fas fa-clock mr-1"></i>
|
||||
{% elif t=="day" %}<i class="fas fa-calendar-day mr-1"></i>
|
||||
{% elif t=="week" %}<i class="fas fa-calendar-week mr-1"></i>
|
||||
{% elif t=="month" %}<i class="fas fa-calendar-alt mr-1"></i>
|
||||
{% elif t=="year" %}<i class="fas fa-calendar mr-1"></i>
|
||||
{% elif t=="all" %}<i class="fas fa-infinity mr-1"></i>
|
||||
{% endif %}
|
||||
{{t | capitalize}}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px);">
|
||||
{% if t != "hour" %}<a class="dropdown-item" href="?sort={{sort}}&t=hour"><i class="fas fa-clock mr-2"></i>Hour</a>{% endif %}
|
||||
{% if t != "day" %}<a class="dropdown-item" href="?sort={{sort}}&t=day"><i class="fas fa-calendar-day mr-2"></i>Day</a>{% endif %}
|
||||
{% if t != "week" %}<a class="dropdown-item" href="?sort={{sort}}&t=week"><i class="fas fa-calendar-week mr-2"></i>Week</a>{% endif %}
|
||||
{% if t != "month" %}<a class="dropdown-item" href="?sort={{sort}}&t=month"><i class="fas fa-calendar-alt mr-2"></i>Month</a>{% endif %}
|
||||
{% if t != "year" %}<a class="dropdown-item" href="?sort={{sort}}&t=year"><i class="fas fa-calendar mr-2"></i>Year</a>{% endif %}
|
||||
{% if t != "all" %}<a class="dropdown-item" href="?sort={{sort}}&t=all"><i class="fas fa-infinity mr-2"></i>All</a>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-small font-weight-bold ml-3 mr-2"></div>
|
||||
{{sorting_time.sort_dropdown(sort, t, SORTS_COMMENTS)}}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% block userpage_content %}
|
||||
<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}" style="margin-top: 10px;">
|
||||
|
||||
<div class="col">
|
||||
|
||||
{% if listing %}
|
||||
<div class="posts p-3 p-md-0">
|
||||
{% with comments=listing %}
|
||||
|
@ -86,13 +26,6 @@
|
|||
</div>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if v %}
|
||||
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
|
||||
<script src="{{ 'js/userpage_v.js' | asset }}"></script>
|
||||
<div id="username" class="d-none">{{u.username}}</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
10
files/templates/userpage_submissions.html
Normal file
10
files/templates/userpage_submissions.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends "userpage.html" %}
|
||||
{% block userpage_content %}
|
||||
<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}" style="margin-top: 10px;">
|
||||
<div class="col">
|
||||
<div class="posts">
|
||||
{% include "submission_listing.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue