remove redundant shit

master
Aevann 2023-09-07 11:51:51 +03:00
parent 08eaf7052f
commit d7eecbdc1a
4 changed files with 1 additions and 103 deletions

View File

@ -1,18 +0,0 @@
function block_user(t) {
const usernameField = document.getElementById("block-username");
const isValidUsername = usernameField.checkValidity();
username = usernameField.value;
if (isValidUsername) {
postToastReload(t,`/settings/block?username=${username}`);
}
}
function unblock_user(t, url) {
postToast(t, url,
{
},
() => {
t.parentElement.parentElement.remove();
}
);
}

View File

@ -654,7 +654,7 @@ def settings_security(v):
@app.get("/settings/blocks")
@auth_required
def settings_blocks(v):
return render_template("settings/blocks.html", v=v)
return redirect(f'/@{v.username}/blocking')
@app.post("/settings/block")
@limiter.limit('1/second', scope=rpath)

View File

@ -21,7 +21,6 @@
<li class="nav-item"><a class="nav-link{% if request.path=='/settings/advanced' %} active{% endif %}" href="/settings/advanced">Advanced</a></li>
<li class="nav-item"><a class="nav-link{% if request.path=='/settings/css' %} active{% endif %}" href="/settings/css">CSS</a></li>
<li class="nav-item"><a class="nav-link{% if request.path=='/settings/security' %} active{% endif %}" href="/settings/security">Security</a></li>
<li class="nav-item"><a class="nav-link{% if request.path=='/settings/blocks' %} active{% endif %}" href="/settings/blocks">Blocks</a></li>
{% if FEATURES["BOTS"] %}
<li class="nav-item"><a class="nav-link{% if request.path=='/settings/apps' %} active{% endif %}" href="/settings/apps">Apps/Bots</a></li>
{% endif %}

View File

@ -1,83 +0,0 @@
{% extends "settings.html" %}
{% block pagetitle %}Blocks{% endblock %}
{% block content %}
<div class="row settings-page" id="settings-page-blocks">
<div class="col col-lg-8">
<div class="settings">
<section id="site-settings-blocks-section" class="settings-section-section">
<div class="row">
<div class="col">
<div class="d-md-flex justify-content-between mb-3">
<div>
<h5>Users you block</h5>
<p class="text-small text-muted mb-md-0">You have blocked the following users. They cannot reply to your content or notify you with a username mention.</p>
</div>
<div class="mt-auto">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#blockmodal">Block user</button>
</div>
</div>
{% if v.blocking.first() %}
<div class="card mb-5">
<div class="overflow-x-auto"><table class="table table-hover rounded mb-0">
<thead class="thead-dark">
<tr>
<th>User</th>
<th>Unblock</th>
</tr>
</thead>
<tbody class="text-muted">
{% for block in v.blocking %}
{% set user=block.target %}
<tr>
<td>
{% include "user_in_table.html" %}
</td>
<td>
<button type="button" class="btn btn-primary" data-nonce="{{g.nonce}}" data-onclick="unblock_user(this, '/settings/unblock?username={{user.username}}&formkey={{v|formkey}}')">Unblock</button>
</td>
</tr>
{% else %}
<td>There are no blocked users</td>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
{{macros.ghost_box('No blocked users', '', 2)}}
{% endif %}
</div>
</div>
</section>
</div>
</div>
</div>
<div class="modal fade" id="blockmodal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Block user</h5>
<button type="button" class="close" data-bs-dismiss="modal">
<span><i class="fas fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<input hidden name="formkey" value="{{v|formkey}}">
<input autocomplete="off" type="text" name="username" placeholder="Enter username..." id="block-username" class="form-control" maxlength=25 required>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="blockUserButton" data-nonce="{{g.nonce}}" data-onclick="block_user(this)">Block user</button>
</div>
</div>
</div>
</div>
<div class="toast error" id="toast-exile-error" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body text-center">
<i class="fas fa-exclamation-circle text-danger mr-2"></i><span id="toast-error-message">Error. Please try again.</span>
</div>
</div>
<script defer src="{{'js/settings_blocks.js' | asset}}"></script>
{% endblock %}