mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
Merge pull request #1467 from bookwyrm-social/admin-views
Organizes admin views
This commit is contained in:
commit
128a5c5754
53 changed files with 400 additions and 278 deletions
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<hr />
|
||||
<hr aria-hidden="true">
|
||||
|
||||
<section class="block" id="display-preferences">
|
||||
<h2 class="title is-4">{% trans "Display preferences" %}</h2>
|
||||
|
@ -94,7 +94,7 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<hr />
|
||||
<hr aria-hidden="true">
|
||||
|
||||
<section class="block" id="privacy">
|
||||
<h2 class="title is-4">{% trans "Privacy" %}</h2>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block panel %}
|
||||
|
||||
<form name="edit-announcement" method="post" action="{% url 'settings-announcements' announcement.id %}" class="block">
|
||||
{% include 'settings/announcement_form.html' with controls_text="edit_announcement" %}
|
||||
{% include 'settings/announcements/announcement_form.html' with controls_text="edit_announcement" %}
|
||||
</form>
|
||||
|
||||
<div class="block content">
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
{% block panel %}
|
||||
<form name="create-announcement" method="post" action="{% url 'settings-announcements' %}" class="block">
|
||||
{% include 'settings/announcement_form.html' with controls_text="create_announcement" %}
|
||||
{% include 'settings/announcements/announcement_form.html' with controls_text="create_announcement" %}
|
||||
</form>
|
||||
|
||||
<div class="block">
|
||||
|
@ -48,11 +48,10 @@
|
|||
<td>{% if announcement.active %}{% trans "active" %}{% else %}{% trans "inactive" %}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if not announcements %}
|
||||
<tr><td colspan="5"><em>{% trans "No announcements found" %}</em></td></tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
{% if not announcements %}
|
||||
<p><em>{% trans "No announcements found." %}</em></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% include 'snippets/pagination.html' with page=announcements path=request.path %}
|
|
@ -67,27 +67,27 @@
|
|||
<form method="get" action="{% url 'settings-dashboard' %}" class="notification has-background-white-bis">
|
||||
<div class="is-flex is-align-items-flex-end">
|
||||
<div class="ml-1 mr-1">
|
||||
<label class="label">
|
||||
<label class="label" for="id_start">
|
||||
{% trans "Start date:" %}
|
||||
<input class="input" type="date" name="start" value="{{ start }}">
|
||||
</label>
|
||||
<input class="input" type="date" name="start" value="{{ start }}" id="id_start">
|
||||
</div>
|
||||
<div class="ml-1 mr-1">
|
||||
<label class="label">
|
||||
<label class="label" for="id_end">
|
||||
{% trans "End date:" %}
|
||||
<input class="input" type="date" name="end" value="{{ end }}">
|
||||
</label>
|
||||
<input class="input" type="date" name="end" value="{{ end }}" id="id_end">
|
||||
</div>
|
||||
<div class="ml-1 mr-1">
|
||||
<label class="label">
|
||||
<label class="label" for="id_interval">
|
||||
{% trans "Interval:" %}
|
||||
<div class="select">
|
||||
<select name="days">
|
||||
<option value="1" {% if interval == 1 %}selected{% endif %}>{% trans "Days" %}</option>
|
||||
<option value="7" {% if interval == 7 %}selected{% endif %}>{% trans "Weeks" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
</label>
|
||||
<div class="select">
|
||||
<select name="days" id="id_interval">
|
||||
<option value="1" {% if interval == 1 %}selected{% endif %}>{% trans "Days" %}</option>
|
||||
<option value="7" {% if interval == 7 %}selected{% endif %}>{% trans "Weeks" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-1 mr-1">
|
||||
<button class="button is-link" type="submit">{% trans "Submit" %}</button>
|
||||
|
@ -115,6 +115,6 @@
|
|||
|
||||
{% block scripts %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.5.1/dist/chart.min.js"></script>
|
||||
{% include 'settings/dashboard_user_chart.html' %}
|
||||
{% include 'settings/dashboard_status_chart.html' %}
|
||||
{% include 'settings/dashboard/dashboard_user_chart.html' %}
|
||||
{% include 'settings/dashboard/dashboard_status_chart.html' %}
|
||||
{% endblock %}
|
|
@ -12,7 +12,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% include 'settings/domain_form.html' with controls_text="add_domain" class="block" %}
|
||||
{% include 'settings/email_blocklist/domain_form.html' with controls_text="add_domain" class="block" %}
|
||||
|
||||
<p class="notification block">
|
||||
{% trans "When someone tries to register with an email from this domain, no account will be created. The registration process will appear to have worked." %}
|
||||
|
@ -55,7 +55,11 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if not domains.exists %}
|
||||
<tr><td colspan="5"><em>{% trans "No email domains currently blocked" %}</em></td></tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -33,6 +33,8 @@
|
|||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-half">
|
||||
<div class="field">
|
||||
<label class="label" for="id_status">{% trans "Status:" %}</label>
|
||||
<div class="select">
|
||||
|
@ -43,6 +45,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column is-half">
|
||||
<div class="field">
|
||||
<label class="label" for="id_application_type">{% trans "Software:" %}</label>
|
||||
|
@ -51,6 +55,8 @@
|
|||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-half">
|
||||
<div class="field">
|
||||
<label class="label" for="id_application_version">{% trans "Version:" %}</label>
|
||||
<input type="text" name="application_version" maxlength="255" class="input" id="id_application_version" value="{{ form.application_version.value|default:'' }}">
|
||||
|
@ -62,7 +68,7 @@
|
|||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_notes">{% trans "Notes:" %}</label>
|
||||
<textarea name="notes" cols="None" rows="None" class="textarea" id="id_notes">{{ form.notes.value|default:'' }}</textarea>
|
||||
<textarea name="notes" cols="40" rows="5" class="textarea" id="id_notes">{{ form.notes.value|default:'' }}</textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="button is-primary">{% trans "Save" %}</button>
|
|
@ -19,18 +19,14 @@
|
|||
<h2 class="title is-4">{% trans "Details" %}</h2>
|
||||
<div class="box is-flex-grow-1 content">
|
||||
<dl>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Software:" %}</dt>
|
||||
<dd>{{ server.application_type }}</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Version:" %}</dt>
|
||||
<dd>{{ server.application_version }}</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Status:" %}</dt>
|
||||
<dd>{{ server.get_status_display }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Software:" %}</dt>
|
||||
<dd>{{ server.application_type }}</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Version:" %}</dt>
|
||||
<dd>{{ server.application_version }}</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Status:" %}</dt>
|
||||
<dd>{{ server.get_status_display }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -39,38 +35,32 @@
|
|||
<h2 class="title is-4">{% trans "Activity" %}</h2>
|
||||
<div class="box is-flex-grow-1 content">
|
||||
<dl>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Users:" %}</dt>
|
||||
<dd>
|
||||
{{ users.count }}
|
||||
{% if server.user_set.count %}(<a href="{% url 'settings-users' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
||||
</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Reports:" %}</dt>
|
||||
<dd>
|
||||
{{ reports.count }}
|
||||
{% if reports.count %}(<a href="{% url 'settings-reports' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
||||
</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Followed by us:" %}</dt>
|
||||
<dd>
|
||||
{{ followed_by_us.count }}
|
||||
</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Followed by them:" %}</dt>
|
||||
<dd>
|
||||
{{ followed_by_them.count }}
|
||||
</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Blocked by us:" %}</dt>
|
||||
<dd>
|
||||
{{ blocked_by_us.count }}
|
||||
</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Users:" %}</dt>
|
||||
<dd>
|
||||
{{ users.count }}
|
||||
{% if server.user_set.count %}(<a href="{% url 'settings-users' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Reports:" %}</dt>
|
||||
<dd>
|
||||
{{ reports.count }}
|
||||
{% if reports.count %}(<a href="{% url 'settings-reports' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Followed by us:" %}</dt>
|
||||
<dd>
|
||||
{{ followed_by_us.count }}
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Followed by them:" %}</dt>
|
||||
<dd>
|
||||
{{ followed_by_them.count }}
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Blocked by us:" %}</dt>
|
||||
<dd>
|
||||
{{ blocked_by_us.count }}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -86,14 +76,13 @@
|
|||
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_notes" %}
|
||||
</div>
|
||||
</header>
|
||||
{% if server.notes %}
|
||||
<div class="box" id="hide_edit_notes">{{ server.notes|to_markdown|safe }}</div>
|
||||
{% endif %}
|
||||
{% trans "<em>No notes</em>" as null_text %}
|
||||
<div class="box" id="hide_edit_notes">{{ server.notes|to_markdown|default:null_text|safe }}</div>
|
||||
<form class="box is-hidden" method="POST" action="{% url 'settings-federated-server' server.id %}" id="edit_notes">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label class="is-sr-only" for="id_notes">Notes:</label>
|
||||
<textarea name="notes" cols="None" rows="None" class="textarea" id="id_notes">{{ server.notes|default:"" }}</textarea>
|
||||
<textarea name="notes" cols="40" rows="5" class="textarea" id="id_notes">{{ server.notes|default:"" }}</textarea>
|
||||
</p>
|
||||
<button type="submit" class="button is-primary">{% trans "Save" %}</button>
|
||||
{% trans "Cancel" as button_text %}
|
|
@ -59,7 +59,11 @@
|
|||
<td>{{ server.get_status_display }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if not servers %}
|
||||
<tr><td colspan="5"><em>{% trans "No instances found" %}</em></td></tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
|
||||
{% include 'snippets/pagination.html' with page=servers path=request.path %}
|
||||
{% endblock %}
|
|
@ -1,6 +1,6 @@
|
|||
{% extends 'snippets/filters_panel/filters_panel.html' %}
|
||||
|
||||
{% block filter_fields %}
|
||||
{% include 'settings/status_filter.html' %}
|
||||
{% include 'settings/invites/status_filter.html' %}
|
||||
{% endblock %}
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
{% endif %} ({{ count }})
|
||||
</h2>
|
||||
|
||||
{% include 'settings/invite_request_filters.html' %}
|
||||
{% include 'settings/invites/invite_request_filters.html' %}
|
||||
|
||||
<table class="table is-striped is-fullwidth">
|
||||
{% url 'settings-invite-requests' as url %}
|
||||
|
@ -47,7 +47,7 @@
|
|||
<th>{% trans "Action" %}</th>
|
||||
</tr>
|
||||
{% if not requests %}
|
||||
<tr><td colspan="4">{% trans "No requests" %}</td></tr>
|
||||
<tr><td colspan="5"><em>{% trans "No requests" %}</em></td></tr>
|
||||
{% endif %}
|
||||
{% for req in requests %}
|
||||
<tr>
|
|
@ -12,7 +12,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% include 'settings/ip_address_form.html' with controls_text="add_address" class="block" %}
|
||||
{% include 'settings/ip_blocklist/ip_address_form.html' with controls_text="add_address" class="block" %}
|
||||
|
||||
<p class="notification block">
|
||||
{% trans "Any traffic from this IP address will get a 404 response when trying to access any part of the application." %}
|
||||
|
@ -42,6 +42,9 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if not addresses.exists %}
|
||||
<tr><td colspan="2"><em>{% trans "No IP addresses currently blocked" %}</em></td></tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
|
@ -74,14 +74,7 @@
|
|||
<li>
|
||||
{% url 'settings-site' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Site Settings" %}</a>
|
||||
{% if url in request.path %}
|
||||
<ul class="emnu-list">
|
||||
<li><a href="{{ url }}#instance-info">{% trans "Instance Info" %}</a></li>
|
||||
<li><a href="{{ url }}#images">{% trans "Images" %}</a></li>
|
||||
<li><a href="{{ url }}#footer">{% trans "Footer Content" %}</a></li>
|
||||
<li><a href="{{ url }}#registration">{% trans "Registration" %}</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% block site-subtabs %}{% endblock %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
|
|
@ -3,20 +3,21 @@
|
|||
{% load humanize %}
|
||||
|
||||
{% block title %}{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}{% endblock %}
|
||||
{% block header %}{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}
|
||||
<a href="{% url 'settings-reports' %}" class="has-text-weight-normal help">{% trans "Back to reports" %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<div class="block">
|
||||
<a href="{% url 'settings-reports' %}">{% trans "Back to reports" %}</a>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
{% include 'moderation/report_preview.html' with report=report %}
|
||||
{% include 'settings/reports/report_preview.html' with report=report %}
|
||||
</div>
|
||||
|
||||
{% include 'user_admin/user_info.html' with user=report.user %}
|
||||
{% include 'settings/users/user_info.html' with user=report.user %}
|
||||
|
||||
{% include 'user_admin/user_moderation_actions.html' with user=report.user %}
|
||||
{% include 'settings/users/user_moderation_actions.html' with user=report.user %}
|
||||
|
||||
<div class="block">
|
||||
<h3 class="title is-4">{% trans "Moderator Comments" %}</h3>
|
|
@ -30,7 +30,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
{% include 'user_admin/user_admin_filters.html' %}
|
||||
{% include 'settings/users/user_admin_filters.html' %}
|
||||
|
||||
<div class="block">
|
||||
{% if not reports %}
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
{% for report in reports %}
|
||||
<div class="block">
|
||||
{% include 'moderation/report_preview.html' with report=report %}
|
||||
{% include 'settings/reports/report_preview.html' with report=report %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -5,36 +5,46 @@
|
|||
|
||||
{% block header %}{% trans "Site Settings" %}{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% block site-subtabs %}
|
||||
<ul class="menu-list">
|
||||
<li><a href="#instance-info">{% trans "Instance Info" %}</a></li>
|
||||
<li><a href="#images">{% trans "Images" %}</a></li>
|
||||
<li><a href="#footer">{% trans "Footer Content" %}</a></li>
|
||||
<li><a href="#registration">{% trans "Registration" %}</a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<form action="{% url 'settings-site' %}" method="POST" class="content" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<section class="block" id="instance_info">
|
||||
<h2 class="title is-4">{% trans "Instance Info" %}</h2>
|
||||
<div class="field">
|
||||
<label class="label" for="id_name">{% trans "Instance Name:" %}</label>
|
||||
{{ site_form.name }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_instance_tagline">{% trans "Tagline:" %}</label>
|
||||
{{ site_form.instance_tagline }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_instance_description">{% trans "Instance description:" %}</label>
|
||||
{{ site_form.instance_description }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label mb-0" for="id_short_description">{% trans "Short description:" %}</label>
|
||||
<p class="help">{% trans "Used when the instance is previewed on joinbookwyrm.com. Does not support html or markdown." %}</p>
|
||||
{{ site_form.instance_short_description }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_code_of_conduct">{% trans "Code of conduct:" %}</label>
|
||||
{{ site_form.code_of_conduct }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_privacy_policy">{% trans "Privacy Policy:" %}</label>
|
||||
{{ site_form.privacy_policy }}
|
||||
<div class="box">
|
||||
<div class="field">
|
||||
<label class="label" for="id_name">{% trans "Instance Name:" %}</label>
|
||||
{{ site_form.name }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_instance_tagline">{% trans "Tagline:" %}</label>
|
||||
{{ site_form.instance_tagline }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_instance_description">{% trans "Instance description:" %}</label>
|
||||
{{ site_form.instance_description }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label mb-0" for="id_short_description">{% trans "Short description:" %}</label>
|
||||
<p class="help">{% trans "Used when the instance is previewed on joinbookwyrm.com. Does not support html or markdown." %}</p>
|
||||
{{ site_form.instance_short_description }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_code_of_conduct">{% trans "Code of conduct:" %}</label>
|
||||
{{ site_form.code_of_conduct }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_privacy_policy">{% trans "Privacy Policy:" %}</label>
|
||||
{{ site_form.privacy_policy }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
@ -42,16 +52,16 @@
|
|||
|
||||
<section class="block" id="images">
|
||||
<h2 class="title is-4">{% trans "Images" %}</h2>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="box is-flex">
|
||||
<div>
|
||||
<label class="label" for="id_logo">{% trans "Logo:" %}</label>
|
||||
{{ site_form.logo }}
|
||||
</div>
|
||||
<div class="column">
|
||||
<div>
|
||||
<label class="label" for="id_logo_small">{% trans "Logo small:" %}</label>
|
||||
{{ site_form.logo_small }}
|
||||
</div>
|
||||
<div class="column">
|
||||
<div>
|
||||
<label class="label" for="id_favicon">{% trans "Favicon:" %}</label>
|
||||
{{ site_form.favicon }}
|
||||
</div>
|
||||
|
@ -62,21 +72,23 @@
|
|||
|
||||
<section class="block" id="footer">
|
||||
<h2 class="title is-4">{% trans "Footer Content" %}</h2>
|
||||
<div class="field">
|
||||
<label class="label" for="id_support_link">{% trans "Support link:" %}</label>
|
||||
<input type="text" name="support_link" maxlength="255" class="input" id="id_support_link" placeholder="https://www.patreon.com/bookwyrm"{% if site.support_link %} value="{{ site.support_link }}"{% endif %}>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_support_title">{% trans "Support title:" %}</label>
|
||||
<input type="text" name="support_title" maxlength="100" class="input" id="id_support_title" placeholder="Patreon"{% if site.support_title %} value="{{ site.support_title }}"{% endif %}>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_admin_email">{% trans "Admin email:" %}</label>
|
||||
{{ site_form.admin_email }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_footer_item">{% trans "Additional info:" %}</label>
|
||||
{{ site_form.footer_item }}
|
||||
<div class="box">
|
||||
<div class="field">
|
||||
<label class="label" for="id_support_link">{% trans "Support link:" %}</label>
|
||||
<input type="text" name="support_link" maxlength="255" class="input" id="id_support_link" placeholder="https://www.patreon.com/bookwyrm"{% if site.support_link %} value="{{ site.support_link }}"{% endif %}>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_support_title">{% trans "Support title:" %}</label>
|
||||
<input type="text" name="support_title" maxlength="100" class="input" id="id_support_title" placeholder="Patreon"{% if site.support_title %} value="{{ site.support_title }}"{% endif %}>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_admin_email">{% trans "Admin email:" %}</label>
|
||||
{{ site_form.admin_email }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_footer_item">{% trans "Additional info:" %}</label>
|
||||
{{ site_form.footer_item }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
@ -84,35 +96,37 @@
|
|||
|
||||
<section class="block" id="registration">
|
||||
<h2 class="title is-4">{% trans "Registration" %}</h2>
|
||||
<div class="field">
|
||||
<label class="label" for="id_allow_registration">
|
||||
{{ site_form.allow_registration }}
|
||||
{% trans "Allow registration" %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_allow_invite_requests">
|
||||
{{ site_form.allow_invite_requests }}
|
||||
{% trans "Allow invite requests" %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label mb-0" for="id_allow_invite_requests">
|
||||
{{ site_form.require_confirm_email }}
|
||||
{% trans "Require users to confirm email address" %}
|
||||
</label>
|
||||
<p class="help">{% trans "(Recommended if registration is open)" %}</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_registration_closed_text">{% trans "Registration closed text:" %}</label>
|
||||
{{ site_form.registration_closed_text }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_invite_request_text">{% trans "Invite request text:" %}</label>
|
||||
{{ site_form.invite_request_text }}
|
||||
{% for error in site_form.invite_request_text.errors %}
|
||||
<p class="help is-danger">{{ error|escape }}</p>
|
||||
{% endfor %}
|
||||
<div class="box">
|
||||
<div class="field">
|
||||
<label class="label" for="id_allow_registration">
|
||||
{{ site_form.allow_registration }}
|
||||
{% trans "Allow registration" %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_allow_invite_requests">
|
||||
{{ site_form.allow_invite_requests }}
|
||||
{% trans "Allow invite requests" %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label mb-0" for="id_require_confirm_email">
|
||||
{{ site_form.require_confirm_email }}
|
||||
{% trans "Require users to confirm email address" %}
|
||||
</label>
|
||||
<p class="help">{% trans "(Recommended if registration is open)" %}</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_registration_closed_text">{% trans "Registration closed text:" %}</label>
|
||||
{{ site_form.registration_closed_text }}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="id_invite_request_text">{% trans "Invite request text:" %}</label>
|
||||
{{ site_form.invite_request_text }}
|
||||
{% for error in site_form.invite_request_text.errors %}
|
||||
<p class="help is-danger">{{ error|escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
16
bookwyrm/templates/settings/users/user.html
Normal file
16
bookwyrm/templates/settings/users/user.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends 'settings/layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{{ user.username }}{% endblock %}
|
||||
{% block header %}
|
||||
{{ user.username }}
|
||||
<a class="help has-text-weight-normal" href="{% url 'settings-users' %}">{% trans "Back to users" %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% include 'settings/users/user_info.html' with user=user %}
|
||||
|
||||
{% include 'settings/users/user_moderation_actions.html' with user=user %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
{% block panel %}
|
||||
|
||||
{% include 'user_admin/user_admin_filters.html' %}
|
||||
{% include 'settings/users/user_admin_filters.html' %}
|
||||
|
||||
<table class="table is-striped">
|
||||
<tr>
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'snippets/filters_panel/filters_panel.html' %}
|
||||
|
||||
{% block filter_fields %}
|
||||
{% include 'user_admin/username_filter.html' %}
|
||||
{% include 'settings/users/username_filter.html' %}
|
||||
{% include 'directory/community_filter.html' %}
|
||||
{% include 'user_admin/server_filter.html' %}
|
||||
{% include 'settings/users/server_filter.html' %}
|
||||
{% endblock %}
|
|
@ -48,58 +48,42 @@
|
|||
<div class="box content is-flex-grow-1">
|
||||
<dl>
|
||||
{% if user.local %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Email:" %}</dt>
|
||||
<dd>{{ user.email }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Email:" %}</dt>
|
||||
<dd>{{ user.email }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% with report_count=user.report_set.count %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Reports:" %}</dt>
|
||||
<dd>
|
||||
{{ report_count|intcomma }}
|
||||
{% if report_count > 0 %}
|
||||
<a href="{% url 'settings-reports' %}?username={{ user.username }}">
|
||||
{% trans "(View reports)" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Reports:" %}</dt>
|
||||
<dd>
|
||||
{{ report_count|intcomma }}
|
||||
{% if report_count > 0 %}
|
||||
<a href="{% url 'settings-reports' %}?username={{ user.username }}">
|
||||
{% trans "(View reports)" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endwith %}
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Blocked by count:" %}</dt>
|
||||
<dd>{{ user.blocked_by.count }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Blocked by count:" %}</dt>
|
||||
<dd>{{ user.blocked_by.count }}</dd>
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Last active date:" %}</dt>
|
||||
<dd>{{ user.last_active_date }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Last active date:" %}</dt>
|
||||
<dd>{{ user.last_active_date }}</dd>
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Manually approved followers:" %}</dt>
|
||||
<dd>{{ user.manually_approves_followers }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Manually approved followers:" %}</dt>
|
||||
<dd>{{ user.manually_approves_followers }}</dd>
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Discoverable:" %}</dt>
|
||||
<dd>{{ user.discoverable }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Discoverable:" %}</dt>
|
||||
<dd>{{ user.discoverable }}</dd>
|
||||
|
||||
{% if not user.is_active %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Deactivation reason:" %}</dt>
|
||||
<dd>{{ user.deactivation_reason }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Deactivation reason:" %}</dt>
|
||||
<dd>{{ user.deactivation_reason }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if not user.is_active and user.deactivation_reason == "pending" %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Confirmation code:" %}</dt>
|
||||
<dd>{{ user.confirmation_code }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Confirmation code:" %}</dt>
|
||||
<dd>{{ user.confirmation_code }}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
|
@ -113,18 +97,14 @@
|
|||
{% if server %}
|
||||
<h5>{{ server.server_name }}</h5>
|
||||
<dl>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Software:" %}</dt>
|
||||
<dd>{{ server.application_type }}</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Version:" %}</dt>
|
||||
<dd>{{ server.application_version }}</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Status:" %}</dt>
|
||||
<dd>{{ server.status }}</dd>
|
||||
</div>
|
||||
<dt class="is-pulled-left mr-5">{% trans "Software:" %}</dt>
|
||||
<dd>{{ server.application_type }}</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Version:" %}</dt>
|
||||
<dd>{{ server.application_version }}</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5">{% trans "Status:" %}</dt>
|
||||
<dd>{{ server.status }}</dd>
|
||||
</dl>
|
||||
{% if server.notes %}
|
||||
<h5>{% trans "Notes" %}</h5>
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
{% include "user_admin/delete_user_form.html" with controls_text="delete_user" class="mt-2 mb-2" %}
|
||||
{% include "settings/users/delete_user_form.html" with controls_text="delete_user" class="mt-2 mb-2" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -6,6 +6,6 @@
|
|||
{% trans "Report" as button_text %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with class="is-danger is-light is-small is-fullwidth" text=button_text controls_text="report" controls_uid=report_uuid focus="modal_title_report" disabled=is_current %}
|
||||
|
||||
{% include 'moderation/report_modal.html' with user=user reporter=request.user controls_text="report" controls_uid=report_uuid %}
|
||||
{% include 'snippets/report_modal.html' with user=user reporter=request.user controls_text="report" controls_uid=report_uuid %}
|
||||
|
||||
{% endwith %}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
{% extends 'settings/layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{{ user.username }}{% endblock %}
|
||||
{% block header %}
|
||||
{{ user.username }}
|
||||
<p class="help has-text-weight-normal">
|
||||
<a href="{% url 'settings-users' %}">{% trans "Back to users" %}</a>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% include 'user_admin/user_info.html' with user=user %}
|
||||
|
||||
{% include 'user_admin/user_moderation_actions.html' with user=user %}
|
||||
|
||||
{% endblock %}
|
||||
|
1
bookwyrm/tests/views/admin/__init__.py
Normal file
1
bookwyrm/tests/views/admin/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from . import *
|
|
@ -1,5 +1,6 @@
|
|||
""" test for app action functionality """
|
||||
from unittest.mock import patch
|
||||
from tidylib import tidy_document
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
@ -34,5 +35,8 @@ class DashboardViews(TestCase):
|
|||
request.user.is_superuser = True
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content)
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
|
@ -1,6 +1,8 @@
|
|||
""" test for app action functionality """
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
from tidylib import tidy_document
|
||||
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
|
@ -46,10 +48,19 @@ class FederationViews(TestCase):
|
|||
request.user.is_superuser = True
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(
|
||||
html.content,
|
||||
options={
|
||||
"drop-empty-elements": False,
|
||||
"warn-proprietary-attributes": False,
|
||||
},
|
||||
)
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_server_page(self):
|
||||
def test_instance_page(self):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
server = models.FederatedServer.objects.create(server_name="hi.there.com")
|
||||
view = views.FederatedServer.as_view()
|
||||
|
@ -59,7 +70,10 @@ class FederationViews(TestCase):
|
|||
|
||||
result = view(request, server.id)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_server_page_block(self):
|
||||
|
@ -148,7 +162,10 @@ class FederationViews(TestCase):
|
|||
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content)
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_add_view_post_create(self):
|
||||
|
@ -169,6 +186,7 @@ class FederationViews(TestCase):
|
|||
self.assertEqual(server.application_type, "coolsoft")
|
||||
self.assertEqual(server.status, "blocked")
|
||||
|
||||
# pylint: disable=consider-using-with
|
||||
def test_import_blocklist(self):
|
||||
"""load a json file with a list of servers to block"""
|
||||
server = models.FederatedServer.objects.create(server_name="hi.there.com")
|
||||
|
@ -180,7 +198,7 @@ class FederationViews(TestCase):
|
|||
{"instance": "hi.there.com", "url": "https://explanation.url"}, # existing
|
||||
{"a": "b"}, # invalid
|
||||
]
|
||||
json.dump(data, open("file.json", "w"))
|
||||
json.dump(data, open("file.json", "w")) # pylint: disable=unspecified-encoding
|
||||
|
||||
view = views.ImportServerBlocklist.as_view()
|
||||
request = self.factory.post(
|
44
bookwyrm/tests/views/admin/test_ip_blocklist.py
Normal file
44
bookwyrm/tests/views/admin/test_ip_blocklist.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
""" test for app action functionality """
|
||||
from unittest.mock import patch
|
||||
from tidylib import tidy_document
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
||||
from bookwyrm import models, views
|
||||
|
||||
|
||||
class IPBlocklistViews(TestCase):
|
||||
"""every response to a get request, html or json"""
|
||||
|
||||
def setUp(self):
|
||||
"""we need basic test data and mocks"""
|
||||
self.factory = RequestFactory()
|
||||
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"), patch(
|
||||
"bookwyrm.activitystreams.populate_stream_task.delay"
|
||||
):
|
||||
self.local_user = models.User.objects.create_user(
|
||||
"mouse@local.com",
|
||||
"mouse@mouse.mouse",
|
||||
"password",
|
||||
local=True,
|
||||
localname="mouse",
|
||||
)
|
||||
|
||||
models.SiteSettings.objects.create()
|
||||
|
||||
def test_blocklist_page_get(self):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.IPBlocklist.as_view()
|
||||
request = self.factory.get("")
|
||||
request.user = self.local_user
|
||||
request.user.is_superuser = True
|
||||
|
||||
result = view(request)
|
||||
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
|
@ -1,6 +1,8 @@
|
|||
""" test for app action functionality """
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
from tidylib import tidy_document
|
||||
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
@ -42,7 +44,16 @@ class ReportViews(TestCase):
|
|||
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(
|
||||
html.content,
|
||||
options={
|
||||
"drop-empty-elements": False,
|
||||
"warn-proprietary-attributes": False,
|
||||
},
|
||||
)
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_reports_page_with_data(self):
|
||||
|
@ -55,7 +66,16 @@ class ReportViews(TestCase):
|
|||
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(
|
||||
html.content,
|
||||
options={
|
||||
"drop-empty-elements": False,
|
||||
"warn-proprietary-attributes": False,
|
||||
},
|
||||
)
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_report_page(self):
|
||||
|
@ -69,7 +89,10 @@ class ReportViews(TestCase):
|
|||
result = view(request, report.id)
|
||||
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_report_comment(self):
|
|
@ -1,5 +1,7 @@
|
|||
""" test for app action functionality """
|
||||
from unittest.mock import patch
|
||||
from tidylib import tidy_document
|
||||
|
||||
from django.contrib.auth.models import Group
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
|
@ -34,7 +36,10 @@ class UserAdminViews(TestCase):
|
|||
request.user.is_superuser = True
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_user_admin_page(self):
|
||||
|
@ -47,7 +52,10 @@ class UserAdminViews(TestCase):
|
|||
result = view(request, self.local_user.id)
|
||||
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
|
@ -69,7 +77,10 @@ class UserAdminViews(TestCase):
|
|||
result = view(request, self.local_user.id)
|
||||
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
|
||||
self.assertEqual(
|
||||
list(self.local_user.groups.values_list("name", flat=True)), ["editor"]
|
|
@ -1,5 +1,7 @@
|
|||
""" test for app action functionality """
|
||||
from unittest.mock import patch
|
||||
from tidylib import tidy_document
|
||||
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
@ -44,7 +46,10 @@ class BlockViews(TestCase):
|
|||
request.user = self.local_user
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content)
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_block_post(self, _):
|
||||
|
|
|
@ -41,7 +41,9 @@ class Announcements(View):
|
|||
"form": forms.AnnouncementForm(),
|
||||
"sort": sort,
|
||||
}
|
||||
return TemplateResponse(request, "settings/announcements.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/announcements/announcements.html", data
|
||||
)
|
||||
|
||||
def post(self, request):
|
||||
"""edit the site settings"""
|
||||
|
@ -56,7 +58,9 @@ class Announcements(View):
|
|||
).get_page(request.GET.get("page")),
|
||||
"form": form,
|
||||
}
|
||||
return TemplateResponse(request, "settings/announcements.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/announcements/announcements.html", data
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
|
@ -74,7 +78,9 @@ class Announcement(View):
|
|||
"announcement": announcement,
|
||||
"form": forms.AnnouncementForm(instance=announcement),
|
||||
}
|
||||
return TemplateResponse(request, "settings/announcement.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/announcements/announcement.html", data
|
||||
)
|
||||
|
||||
def post(self, request, announcement_id):
|
||||
"""edit announcement"""
|
||||
|
@ -87,7 +93,9 @@ class Announcement(View):
|
|||
"announcement": announcement,
|
||||
"form": form,
|
||||
}
|
||||
return TemplateResponse(request, "settings/announcement.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/announcements/announcement.html", data
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
|
@ -85,4 +85,4 @@ class Dashboard(View):
|
|||
"user_stats": user_stats,
|
||||
"status_stats": status_stats,
|
||||
}
|
||||
return TemplateResponse(request, "settings/dashboard.html", data)
|
||||
return TemplateResponse(request, "settings/dashboard/dashboard.html", data)
|
||||
|
|
|
@ -22,7 +22,9 @@ class EmailBlocklist(View):
|
|||
"domains": models.EmailBlocklist.objects.order_by("-created_date").all(),
|
||||
"form": forms.EmailBlocklistForm(),
|
||||
}
|
||||
return TemplateResponse(request, "settings/email_blocklist.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/email_blocklist/email_blocklist.html", data
|
||||
)
|
||||
|
||||
def post(self, request, domain_id=None):
|
||||
"""create a new domain block"""
|
||||
|
@ -35,11 +37,15 @@ class EmailBlocklist(View):
|
|||
"form": form,
|
||||
}
|
||||
if not form.is_valid():
|
||||
return TemplateResponse(request, "settings/email_blocklist.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/email_blocklist/email_blocklist.html", data
|
||||
)
|
||||
form.save()
|
||||
|
||||
data["form"] = forms.EmailBlocklistForm()
|
||||
return TemplateResponse(request, "settings/email_blocklist.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/email_blocklist/email_blocklist.html", data
|
||||
)
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def delete(self, request, domain_id):
|
||||
|
|
|
@ -44,7 +44,7 @@ class Federation(View):
|
|||
"sort": sort,
|
||||
"form": forms.ServerForm(),
|
||||
}
|
||||
return TemplateResponse(request, "settings/federation.html", data)
|
||||
return TemplateResponse(request, "settings/federation/instance_list.html", data)
|
||||
|
||||
|
||||
class AddFederatedServer(View):
|
||||
|
@ -53,14 +53,16 @@ class AddFederatedServer(View):
|
|||
def get(self, request):
|
||||
"""add server form"""
|
||||
data = {"form": forms.ServerForm()}
|
||||
return TemplateResponse(request, "settings/edit_server.html", data)
|
||||
return TemplateResponse(request, "settings/federation/edit_instance.html", data)
|
||||
|
||||
def post(self, request):
|
||||
"""add a server from the admin panel"""
|
||||
form = forms.ServerForm(request.POST)
|
||||
if not form.is_valid():
|
||||
data = {"form": form}
|
||||
return TemplateResponse(request, "settings/edit_server.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/federation/edit_instance.html", data
|
||||
)
|
||||
server = form.save()
|
||||
return redirect("settings-federated-server", server.id)
|
||||
|
||||
|
@ -75,7 +77,7 @@ class ImportServerBlocklist(View):
|
|||
|
||||
def get(self, request):
|
||||
"""add server form"""
|
||||
return TemplateResponse(request, "settings/server_blocklist.html")
|
||||
return TemplateResponse(request, "settings/federation/instance_blocklist.html")
|
||||
|
||||
def post(self, request):
|
||||
"""add a server from the admin panel"""
|
||||
|
@ -98,7 +100,9 @@ class ImportServerBlocklist(View):
|
|||
server.block()
|
||||
success_count += 1
|
||||
data = {"failed": failed, "succeeded": success_count}
|
||||
return TemplateResponse(request, "settings/server_blocklist.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/federation/instance_blocklist.html", data
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
|
@ -123,7 +127,7 @@ class FederatedServer(View):
|
|||
user_subject__in=users.all()
|
||||
),
|
||||
}
|
||||
return TemplateResponse(request, "settings/federated_server.html", data)
|
||||
return TemplateResponse(request, "settings/federation/instance.html", data)
|
||||
|
||||
def post(self, request, server): # pylint: disable=unused-argument
|
||||
"""update note"""
|
||||
|
|
|
@ -45,7 +45,7 @@ class ManageInvites(View):
|
|||
),
|
||||
"form": forms.CreateInviteForm(),
|
||||
}
|
||||
return TemplateResponse(request, "settings/manage_invites.html", data)
|
||||
return TemplateResponse(request, "settings/invites/manage_invites.html", data)
|
||||
|
||||
def post(self, request):
|
||||
"""creates an invite database entry"""
|
||||
|
@ -64,7 +64,7 @@ class ManageInvites(View):
|
|||
PAGE_LENGTH,
|
||||
)
|
||||
data = {"invites": paginated.page(1), "form": form}
|
||||
return TemplateResponse(request, "settings/manage_invites.html", data)
|
||||
return TemplateResponse(request, "settings/invites/manage_invites.html", data)
|
||||
|
||||
|
||||
class Invite(View):
|
||||
|
@ -135,7 +135,9 @@ class ManageInviteRequests(View):
|
|||
),
|
||||
"sort": sort,
|
||||
}
|
||||
return TemplateResponse(request, "settings/manage_invite_requests.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/invites/manage_invite_requests.html", data
|
||||
)
|
||||
|
||||
def post(self, request):
|
||||
"""send out an invite"""
|
||||
|
|
|
@ -22,7 +22,9 @@ class IPBlocklist(View):
|
|||
"addresses": models.IPBlocklist.objects.all(),
|
||||
"form": forms.IPBlocklistForm(),
|
||||
}
|
||||
return TemplateResponse(request, "settings/ip_blocklist.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/ip_blocklist/ip_blocklist.html", data
|
||||
)
|
||||
|
||||
def post(self, request, block_id=None):
|
||||
"""create a new ip address block"""
|
||||
|
@ -35,11 +37,15 @@ class IPBlocklist(View):
|
|||
"form": form,
|
||||
}
|
||||
if not form.is_valid():
|
||||
return TemplateResponse(request, "settings/ip_blocklist.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/ip_blocklist/ip_blocklist.html", data
|
||||
)
|
||||
form.save()
|
||||
|
||||
data["form"] = forms.IPBlocklistForm()
|
||||
return TemplateResponse(request, "settings/ip_blocklist.html", data)
|
||||
return TemplateResponse(
|
||||
request, "settings/ip_blocklist/ip_blocklist.html", data
|
||||
)
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def delete(self, request, domain_id):
|
||||
|
|
|
@ -40,7 +40,7 @@ class Reports(View):
|
|||
"server": server,
|
||||
"reports": models.Report.objects.filter(**filters),
|
||||
}
|
||||
return TemplateResponse(request, "moderation/reports.html", data)
|
||||
return TemplateResponse(request, "settings/reports/reports.html", data)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
|
@ -60,7 +60,7 @@ class Report(View):
|
|||
data = {
|
||||
"report": get_object_or_404(models.Report, id=report_id),
|
||||
}
|
||||
return TemplateResponse(request, "moderation/report.html", data)
|
||||
return TemplateResponse(request, "settings/reports/report.html", data)
|
||||
|
||||
def post(self, request, report_id):
|
||||
"""comment on a report"""
|
||||
|
|
|
@ -57,7 +57,7 @@ class UserAdminList(View):
|
|||
"sort": sort,
|
||||
"server": server,
|
||||
}
|
||||
return TemplateResponse(request, "user_admin/user_admin.html", data)
|
||||
return TemplateResponse(request, "settings/users/user_admin.html", data)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
|
@ -72,7 +72,7 @@ class UserAdmin(View):
|
|||
"""user view"""
|
||||
user = get_object_or_404(models.User, id=user)
|
||||
data = {"user": user, "group_form": forms.UserGroupForm()}
|
||||
return TemplateResponse(request, "user_admin/user.html", data)
|
||||
return TemplateResponse(request, "settings/users/user.html", data)
|
||||
|
||||
def post(self, request, user):
|
||||
"""update user group"""
|
||||
|
@ -81,4 +81,4 @@ class UserAdmin(View):
|
|||
if form.is_valid():
|
||||
form.save()
|
||||
data = {"user": user, "group_form": form}
|
||||
return TemplateResponse(request, "user_admin/user.html", data)
|
||||
return TemplateResponse(request, "settings/users/user.html", data)
|
||||
|
|
Loading…
Reference in a new issue