changes to bring domain view and user settings design into line with the rest of the site #91

This commit is contained in:
rimu 2024-03-11 20:14:12 +13:00
parent 60971ab754
commit fecc67f589
15 changed files with 293 additions and 476 deletions

View file

@ -74,9 +74,13 @@ def domains():
return render_template('domain/domains.html', title='All known domains', domains=domains, return render_template('domain/domains.html', title='All known domains', domains=domains,
next_url=next_url, prev_url=prev_url, search=search, ban_visibility_permission=ban_visibility_permission) next_url=next_url, prev_url=prev_url, search=search, ban_visibility_permission=ban_visibility_permission)
@bp.route('/domains/banned', methods=['GET']) @bp.route('/domains/banned', methods=['GET'])
@login_required @login_required
def blocked_domains(): def blocked_domains():
if not current_user.trustworthy():
abort(404)
page = request.args.get('page', 1, type=int) page = request.args.get('page', 1, type=int)
search = request.args.get('search', '') search = request.args.get('search', '')
@ -86,15 +90,11 @@ def blocked_domains():
domains = domains.order_by(Domain.name) domains = domains.order_by(Domain.name)
domains = domains.paginate(page=page, per_page=100, error_out=False) domains = domains.paginate(page=page, per_page=100, error_out=False)
ban_visibility_permission = False
if not current_user.created_recently() and current_user.reputation > 100 or current_user.is_admin():
ban_visibility_permission = True
next_url = url_for('domain.domains', page=domains.next_num) if domains.has_next else None next_url = url_for('domain.domains', page=domains.next_num) if domains.has_next else None
prev_url = url_for('domain.domains', page=domains.prev_num) if domains.has_prev and page != 1 else None prev_url = url_for('domain.domains', page=domains.prev_num) if domains.has_prev and page != 1 else None
return render_template('domain/domains_banned.html', title='Domains banned on this instance', domains=domains, return render_template('domain/domains_blocked.html', title='Domains blocked on this instance', domains=domains,
next_url=next_url, prev_url=prev_url, search=search, ban_visibility_permission=ban_visibility_permission) next_url=next_url, prev_url=prev_url, search=search)
@bp.route('/d/<int:domain_id>/block') @bp.route('/d/<int:domain_id>/block')

View file

@ -591,6 +591,13 @@ class User(UserMixin, db.Model):
return True return True
return False return False
def trustworthy(self):
if self.is_admin():
return True
if self.created_recently() or self.reputation < 100:
return False
return True
def link(self) -> str: def link(self) -> str:
if self.is_local(): if self.is_local():
return self.user_name return self.user_name
@ -1075,7 +1082,8 @@ class Filter(db.Model):
def keywords_string(self): def keywords_string(self):
if self.keywords is None or self.keywords == '': if self.keywords is None or self.keywords == '':
return '' return ''
return ', '.join(self.keywords.split('\n')) split_keywords = [kw.strip() for kw in self.keywords.split('\n')]
return ', '.join(split_keywords)
class Role(db.Model): class Role(db.Model):

View file

@ -167,10 +167,8 @@
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="/u/{{ current_user.user_name }}" aria-haspopup="true" aria-expanded="false">{{ _('Account') }}</a> <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="/u/{{ current_user.user_name }}" aria-haspopup="true" aria-expanded="false">{{ _('Account') }}</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a class="dropdown-item{% if active_child == 'view_profile' %} active{% endif %}" href="/u/{{ current_user.user_name }}">{{ _('View profile') }}</a></li> <li><a class="dropdown-item{% if active_child == 'view_profile' %} active{% endif %}" href="/u/{{ current_user.user_name }}">{{ _('View profile') }}</a></li>
<li><a class="dropdown-item{% if active_child == 'edit_profile' %} active{% endif %}" href="/u/{{ current_user.user_name }}/profile">{{ _('Edit profile') }}</a></li> <li><a class="dropdown-item{% if active_child == 'edit_profile' %} active{% endif %}" href="/u/{{ current_user.user_name }}/settings">{{ _('Edit profile & settings') }}</a></li>
<li><a class="dropdown-item{% if active_child == 'chats' %} active{% endif %}" href="/chat">{{ _('Chats') }}</a></li> <li><a class="dropdown-item{% if active_child == 'chats' %} active{% endif %}" href="/chat">{{ _('Chats') }}</a></li>
<li><a class="dropdown-item{% if active_child == 'settings' %} active{% endif %}" href="/user/settings">{{ _('Settings') }}</a></li>
<li><a class="dropdown-item{% if active_child == 'filters' %} active{% endif %}" href="/user/settings/filters">{{ _('Filters') }}</a></li>
</ul> </ul>
</li> </li>
<li class="nav-item"><a class="nav-link" href="/donate">{{ _('Donate') }}</a></li> <li class="nav-item"><a class="nav-link" href="/donate">{{ _('Donate') }}</a></li>

View file

@ -6,35 +6,32 @@
{% from 'bootstrap/form.html' import render_form %} {% from 'bootstrap/form.html' import render_form %}
{% block app_content %} {% block app_content %}
<div class="card col-md-8" style="max-width:unset;"> <div class="row">
<div class="card-header"> <div class="col-12 col-md-8 position-relative main_pane">
<nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item active">Domains</li>
</ol>
</nav>
<ul class="nav nav-tabs flex-column flex-sm-row card-header-tabs">
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link active" href="/domains">All Domains</a>
</li>
{% if not current_user.is_anonymous %}
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/domains/banned">Banned Domains</a>
</li>
{% endif %}
</ul>
</div>
<div class="card-body">
<h1 class="">{{ _('Domains') }}</h1>
{% if search == '' %} {% if search == '' %}
<p class="card-text">All domains this instance knows about</p> <h1>{{ _('Domains') }}</h1>
{% else %} {% else %}
<p class="card-text">Domains containing "{{ _('%(search)s', search=search) }}"</p> <h1>{{ _('Domains containing "%(search)s"', search=search) }}</h1>
{% endif %} {% endif %}
{% if not current_user.is_anonymous and current_user.trustworthy() %}
<div class="row">
<div class="col-auto">
<div class="btn-group">
<a href="/domains" class="btn {{ 'btn-primary' if request.path == '/domains' else 'btn-outline-secondary' }}">
{{ _('Domains') }}
</a>
<a href="/domains/banned" class="btn {{ 'btn-primary' if request.path == '/domains/banned' else 'btn-outline-secondary' }}">
{{ _('Banned domains') }}
</a>
</div>
</div>
<div class="col-auto">
<form method="get"><input type="search" name="search" value="{{ search }}" placeholder="{{ _('Search') }}" autofocus></form> <form method="get"><input type="search" name="search" value="{{ search }}" placeholder="{{ _('Search') }}" autofocus></form>
</div>
</div>
{% endif %}
<div class="table-responsive-sm"> <div class="table-responsive-sm pt-4">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>Domain</th> <th>Domain</th>
@ -69,7 +66,9 @@
{% endif %} {% endif %}
</nav> </nav>
</div> </div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,77 +0,0 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
{% from 'bootstrap/form.html' import render_form %}
{% block app_content %}
<div class="card col-md-8" style="max-width:unset;">
<div class="card-header">
<nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item active">Domains</li>
</ol>
</nav>
<ul class="nav nav-tabs flex-column flex-sm-row card-header-tabs">
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/domains">All Domains</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link active" href="/domains/banned">Banned Domains</a>
</li>
</ul>
</div>
<div class="card-body">
<h1 class="">{{ _('Domains') }}</h1>
{% if not ban_visibility_permission %}
<p class="card-text">Your account is either too new or too low reputation to be able to see banned domains on this instance.</p>
{% else %}
{% if search == '' %}
<p class="card-text">All domains this instance banned</p>
{% else %}
<p class="card-text">Banned domains containing "{{ _('%(search)s', search=search) }}"</p>
{% endif %}
<form method="get"><input type="search" name="search" value="{{ search }}" placeholder="{{ _('Search') }}" autofocus></form>
<div class="table-responsive-sm">
<table class="table table-striped">
<tr>
<th>Domain</th>
{% if user_access('ban users', current_user.id) or user_access('manage users', current_user.id) %}<th>Actions</th>{%endif%}
</tr>
{% for domain in domains %}
<tr>
<td><a href="{{ url_for('domain.show_domain', domain_id=domain.id) }}">{{ domain.name }}</a></td>
<td>
{% if user_access('ban users', current_user.id) or user_access('manage users', current_user.id) %}
{% if domain.banned %}
<a class="btn btn-primary confirm_first" title="{{ _('Unbanning this domain allows future posts linking to that domain.') }}" href="/d/{{ domain.id }}/unban">{{ _('Unban') }}</a>
{% else %}
<a class="btn btn-primary confirm_first" title="{{ _('Banning this domain will delete all posts linking to this domain and prevent future posts linking to that domain.') }}" href="/d/{{ domain.id }}/ban">{{ _('Ban') }}</a>
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
<nav aria-label="Pagination" class="mt-4" role="navigation">
{% if prev_url %}
<a href="{{ prev_url }}" class="btn btn-primary" rel="nofollow">
<span aria-hidden="true">&larr;</span> {{ _('Previous page') }}
</a>
{% endif %}
{% if next_url %}
<a href="{{ next_url }}" class="btn btn-primary" rel="nofollow">
{{ _('Next page') }} <span aria-hidden="true">&rarr;</span>
</a>
{% endif %}
</nav>
</div>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,71 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
{% from 'bootstrap/form.html' import render_form %}
{% block app_content %}
<div class="row">
<div class="col-12 col-md-8 position-relative main_pane">
{% if search == '' %}
<h1>{{ _('Blocked domains') }}</h1>
{% else %}
<h1>{{ _('Blocked domains containing "%(search)s"', search=search) }}</h1>
{% endif %}
{% if not current_user.is_anonymous and current_user.trustworthy() %}
<div class="row">
<div class="col-auto">
<div class="btn-group">
<a href="/domains" class="btn {{ 'btn-primary' if request.path == '/domains' else 'btn-outline-secondary' }}">
{{ _('Domains') }}
</a>
<a href="/domains/banned" class="btn {{ 'btn-primary' if request.path == '/domains/banned' else 'btn-outline-secondary' }}">
{{ _('Banned domains') }}
</a>
</div>
</div>
<div class="col-auto">
<form method="get"><input type="search" name="search" value="{{ search }}" placeholder="{{ _('Search') }}" autofocus></form>
</div>
</div>
{% endif %}
<div class="table-responsive-sm pt-4">
<table class="table table-striped">
<tr>
<th>Domain</th>
{% if user_access('ban users', current_user.id) or user_access('manage users', current_user.id) %}<th>Actions</th>{%endif%}
</tr>
{% for domain in domains %}
<tr>
<td><a href="{{ url_for('domain.show_domain', domain_id=domain.id) }}">{{ domain.name }}</a></td>
<td>
{% if user_access('ban users', current_user.id) or user_access('manage users', current_user.id) %}
{% if domain.banned %}
<a class="btn btn-primary confirm_first" title="{{ _('Unbanning this domain allows future posts linking to that domain.') }}" href="/d/{{ domain.id }}/unban">{{ _('Unban') }}</a>
{% else %}
<a class="btn btn-primary confirm_first" title="{{ _('Banning this domain will delete all posts linking to this domain and prevent future posts linking to that domain.') }}" href="/d/{{ domain.id }}/ban">{{ _('Ban') }}</a>
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
<nav aria-label="Pagination" class="mt-4" role="navigation">
{% if prev_url %}
<a href="{{ prev_url }}" class="btn btn-primary" rel="nofollow">
<span aria-hidden="true">&larr;</span> {{ _('Previous page') }}
</a>
{% endif %}
{% if next_url %}
<a href="{{ next_url }}" class="btn btn-primary" rel="nofollow">
{{ _('Next page') }} <span aria-hidden="true">&rarr;</span>
</a>
{% endif %}
</nav>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,15 @@
<div class="row mb-4">
<div class="col-auto">
<div class="btn-group">
<a href="/user/settings" class="btn {{ 'btn-primary' if request.path == '/user/settings' else 'btn-outline-secondary' }}">
{{ _('Settings') }}
</a>
<a href="/u/{{ current_user.user_name }}/profile" class="btn {{ 'btn-primary' if request.path.endswith('/profile') else 'btn-outline-secondary' }}">
{{ _('Profile') }}
</a>
<a href="/user/settings/filters" class="btn {{ 'btn-primary' if request.path == '/user/settings/filters' else 'btn-outline-secondary' }}">
{{ _('Blocks & Filters') }}
</a>
</div>
</div>
</div>

View file

@ -7,20 +7,18 @@
{% set active_child = 'filters' %} {% set active_child = 'filters' %}
{% block app_content %} {% block app_content %}
<div class="row"> <div class="row">
<div class="col main_pane"> <div class="col-12 col-md-8 position-relative main_pane">
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation"> <nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li> <li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li> <li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
<li class="breadcrumb-item"><a href="/user/settings">{{ _('Settings') }}</a></li>
<li class="breadcrumb-item"><a href="/user/settings/filters">{{ _('Filters') }}</a></li> <li class="breadcrumb-item"><a href="/user/settings/filters">{{ _('Filters') }}</a></li>
{% if content_filter %} {% if content_filter %}
<li class="breadcrumb-item active">{{ _('Edit filter') }}</li> <li class="breadcrumb-item active">{{ _('Edit filter') }}</li>
{% else %} {% else %}
<li class="breadcrumb-item active">{{ _('Add filter') }}</li> <li class="breadcrumb-item active">{{ _('Add filter') }}</li>
{% endif %} {% endif %}
</ol> </ol>
</nav> </nav>
{% if content_filter %} {% if content_filter %}
@ -28,6 +26,7 @@
{% else %} {% else %}
<h1 class="mt-2">{{ _('Add filter') }}</h1> <h1 class="mt-2">{{ _('Add filter') }}</h1>
{% endif %} {% endif %}
{% include "user/_user_nav.html" %}
<form method='post' role="form"> <form method='post' role="form">
{{ form.csrf_token() }} {{ form.csrf_token() }}
{{ render_field(form.title) }} {{ render_field(form.title) }}
@ -43,5 +42,5 @@
{{ render_field(form.submit) }} {{ render_field(form.submit) }}
</form> </form>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -7,22 +7,25 @@
{% from 'bootstrap/form.html' import render_field %} {% from 'bootstrap/form.html' import render_field %}
{% block app_content %} {% block app_content %}
<div class="row"> <div class="row">
<div class="col main_pane"> <div class="col-12 col-md-8 position-relative main_pane">
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation"> <nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li> <li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li> <li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
<li class="breadcrumb-item active">{{ _('Edit profile') }}</li> <li class="breadcrumb-item active">{{ _('Edit profile') }}</li>
</ol> </ol>
</nav> </nav>
<h1 class="mt-2">{{ _('Edit profile of %(name)s', name=user.user_name) }}</h1> <h1>{{ _('Edit profile of %(name)s', name=user.user_name) }}</h1>
{% include "user/_user_nav.html" %}
<form method='post' enctype="multipart/form-data" role="form" autocomplete="off"> <form method='post' enctype="multipart/form-data" role="form" autocomplete="off">
{{ form.csrf_token() }} {{ form.csrf_token() }}
{{ render_field(form.title) }}
{{ render_field(form.email) }} {{ render_field(form.email) }}
{{ render_field(form.password_field) }} {{ render_field(form.password_field) }}
<hr /> <h5> Profile Data </h5>
{{ render_field(form.title) }}
{{ render_field(form.about) }} {{ render_field(form.about) }}
{% if not low_bandwidth %} {% if not low_bandwidth %}
{% if markdown_editor %} {% if markdown_editor %}
@ -41,19 +44,19 @@
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="about">{{ _('Enable markdown editor') }}</a> <a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="about">{{ _('Enable markdown editor') }}</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{{ render_field(form.bot) }}
{{ render_field(form.matrixuserid) }} {{ render_field(form.matrixuserid) }}
<small class="field_hint">e.g. @something:matrix.org. Include leading @ and use : before server</small> <small class="field_hint">e.g. @something:matrix.org. Include leading @ and use : before server</small>
<h5> Profile Images </h5>
{{ render_field(form.profile_file) }} {{ render_field(form.profile_file) }}
<small class="field_hint">Provide a square image that looks good when small.</small> <small class="field_hint">Provide a square image that looks good when small.</small>
{{ render_field(form.banner_file) }} {{ render_field(form.banner_file) }}
<small class="field_hint">Provide a wide image - letterbox orientation.</small> <small class="field_hint">Provide a wide image - letterbox orientation.</small>
<hr />
{{ render_field(form.bot) }}
{{ render_field(form.submit) }} {{ render_field(form.submit) }}
</form> </form>
<p class="mt-4 pt-4"> <p class="mt-4 pt-4">
<a class="btn btn-warning" href="{{ url_for('user.delete_account') }}">{{ _('Delete account') }}</a> <a class="btn btn-warning" href="{{ url_for('user.delete_account') }}">{{ _('Delete account') }}</a>
</p> </p>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,77 +0,0 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
{% set active_child = 'edit_profile' %}
{% from 'bootstrap/form.html' import render_field %}
{% block app_content %}
<div class="card col-md-8" style="max-width:unset;">
<div class="card-header">
<nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
<li class="breadcrumb-item active">{{ _('Edit profile') }}</li>
</ol>
</nav>
<ul class="nav nav-tabs flex-column flex-sm-row card-header-tabs">
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/user/settings">Basic</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/user/settings/filters">Blocks & Filters</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link active" href="/u/{{ current_user.user_name }}/profile">Profile</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link disabled" href="#">Other</a>
</li>
</ul>
</div>
<div class="card-body">
<h1>{{ _('Edit profile of %(name)s', name=user.user_name) }}</h1>
<p class="card-text"></p>
<form method='post' enctype="multipart/form-data" role="form" autocomplete="off">
{{ form.csrf_token() }}
{{ render_field(form.email) }}
{{ render_field(form.password_field) }}
<h5> Profile Data </h5>
{{ render_field(form.title) }}
{{ render_field(form.about) }}
{% if not low_bandwidth %}
{% if markdown_editor %}
<script nonce="{{ session['nonce'] }}">
window.addEventListener("load", function () {
var downarea = new DownArea({
elem: document.querySelector('#about'),
resize: DownArea.RESIZE_VERTICAL,
hide: ['heading', 'bold-italic'],
value: {{ form.about.data | tojson | safe }}
});
setupAutoResize('about');
});
</script>
{% else %}
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="about">{{ _('Enable markdown editor') }}</a>
{% endif %}
{% endif %}
{{ render_field(form.bot) }}
{{ render_field(form.matrixuserid) }}
<small class="field_hint">e.g. @something:matrix.org. Include leading @ and use : before server</small>
<h5> Profile Images </h5>
{{ render_field(form.profile_file) }}
<small class="field_hint">Provide a square image that looks good when small.</small>
{{ render_field(form.banner_file) }}
<small class="field_hint">Provide a wide image - letterbox orientation.</small>
{{ render_field(form.submit) }}
</form>
<p class="mt-4 pt-4">
<a class="btn btn-warning" href="{{ url_for('user.delete_account') }}">{{ _('Delete account') }}</a>
</p>
</div>
</div>
{% endblock %}

View file

@ -7,32 +7,37 @@
{% set active_child = 'settings' %} {% set active_child = 'settings' %}
{% block app_content %} {% block app_content %}
<div class="row">
<div class="col main_pane"> <div class="row">
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation"> <div class="col-12 col-md-8 position-relative main_pane">
<nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li> <li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li> <li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
<li class="breadcrumb-item active">{{ _('Change settings') }}</li> <li class="breadcrumb-item active">{{ _('Change settings') }}</li>
</ol> </ol>
</nav> </nav>
<h1 class="mt-2">{{ _('Change settings') }}</h1> <h1>{{ _('Change settings') }}</h1>
{% include "user/_user_nav.html" %}
<form method='post' enctype="multipart/form-data" role="form"> <form method='post' enctype="multipart/form-data" role="form">
{{ form.csrf_token() }} {{ form.csrf_token() }}
<h5> Mail Settings </h5>
{{ render_field(form.newsletter) }} {{ render_field(form.newsletter) }}
{{ render_field(form.email_unread) }} {{ render_field(form.email_unread) }}
<h5> Visibility </h5>
{{ render_field(form.ignore_bots) }} {{ render_field(form.ignore_bots) }}
{{ render_field(form.nsfw) }} {{ render_field(form.nsfw) }}
{{ render_field(form.nsfl) }} {{ render_field(form.nsfl) }}
{{ render_field(form.markdown_editor) }}
{{ render_field(form.searchable) }} {{ render_field(form.searchable) }}
{{ render_field(form.indexable) }} {{ render_field(form.indexable) }}
<h5> Preferences </h5>
{{ render_field(form.markdown_editor) }}
{{ render_field(form.default_sort) }} {{ render_field(form.default_sort) }}
{{ render_field(form.import_file) }}
{{ render_field(form.theme) }} {{ render_field(form.theme) }}
<h5>Import</h5>
{{ render_field(form.import_file) }}
{{ render_field(form.submit) }} {{ render_field(form.submit) }}
&nbsp;&nbsp;<a href="{{ url_for('user.user_settings_filters') }}">{{ _('Manage content filters') }}</a>
</form> </form>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,59 +0,0 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
{% from 'bootstrap/form.html' import render_field %}
{% set active_child = 'settings' %}
{% block app_content %}
<div class="card col-md-8" style="max-width:unset;">
<div class="card-header">
<nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
<li class="breadcrumb-item active">{{ _('Change settings') }}</li>
</ol>
</nav>
<ul class="nav nav-tabs flex-column flex-sm-row card-header-tabs">
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link active" href="/user/settings">Basic</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/user/settings/filters">Blocks & Filters</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/u/{{ current_user.user_name }}/profile">Profile</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link disabled" href="#">Other</a>
</li>
</ul>
</div>
<div class="card-body">
<h1>{{ _('Change settings') }}</h1>
<p class="card-text">Change your basic settings and preferences </p>
<form method='post' enctype="multipart/form-data" role="form">
{{ form.csrf_token() }}
<h5> Mail Settings </h5>
{{ render_field(form.newsletter) }}
{{ render_field(form.email_unread) }}
<h5> Visibility </h5>
{{ render_field(form.ignore_bots) }}
{{ render_field(form.nsfw) }}
{{ render_field(form.nsfl) }}
{{ render_field(form.searchable) }}
{{ render_field(form.indexable) }}
<h5> Preferences </h5>
{{ render_field(form.markdown_editor) }}
{{ render_field(form.default_sort) }}
{{ render_field(form.theme) }}
<h5>Import</h5>
{{ render_field(form.import_file) }}
{{ render_field(form.submit) }}
</form>
</div>
</div>
{% endblock %}

View file

@ -7,21 +7,22 @@
{% set active_child = 'filters' %} {% set active_child = 'filters' %}
{% block app_content %} {% block app_content %}
<div class="row"> <div class="row">
<div class="col main_pane"> <div class="col-12 col-md-8 position-relative main_pane">
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation"> <nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li> <li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li> <li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
<li class="breadcrumb-item active"><a href="/user/settings">{{ _('Settings') }}</a></li>
<li class="breadcrumb-item active">{{ _('Filters') }}</li> <li class="breadcrumb-item active">{{ _('Filters') }}</li>
</ol> </ol>
</nav> </nav>
<h1>{{ _('Filters') }}</h1>
{% include "user/_user_nav.html" %}
<div class="rh_action_buttons"> <div class="rh_action_buttons">
<a class="btn btn-primary" href="{{ url_for('user.user_settings_filters_add') }}">{{ _('Add filter') }}</a> <a class="btn btn-primary" href="{{ url_for('user.user_settings_filters_add') }}">{{ _('Add filter') }}</a>
</div> </div>
<h1 class="mt-2">{{ _('Filters') }}</h1>
<p>{{ _('Filters can hide posts that contain keywords you specify, either by making them less noticeable or invisible.') }}</p> <p class="card-text">{{ _('Filters can hide posts that contain keywords you specify, either by making them less noticeable or invisible.') }}</p>
{% if filters %} {% if filters %}
<table class="table table-striped" role="table"> <table class="table table-striped" role="table">
<tr> <tr>
@ -47,6 +48,12 @@
{% else %} {% else %}
<p>{{ _('No filters defined yet.') }}</p> <p>{{ _('No filters defined yet.') }}</p>
{% endif %} {% endif %}
<h5>Blocks</h5>
<p class="card-text">Manage what users, communities, domains or instances you want to block. Blocking them means you will no longer see any posts associated with them.</p>
<a class="btn btn-primary" href="">Manage User Blocks</a>
<a class="btn btn-primary" href="">Manage Communities Blocks</a>
<a class="btn btn-primary" href="">Manage Domain Blocks</a>
<a class="btn btn-primary" href="">Manage Instance Blocks</a>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,76 +0,0 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
{% from 'bootstrap/form.html' import render_field %}
{% set active_child = 'filters' %}
{% block app_content %}
<div class="card col-md-8" style="max-width:unset;">
<div class="card-header">
<nav class="mb-2" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
<li class="breadcrumb-item active"><a href="/user/settings">{{ _('Settings') }}</a></li>
<li class="breadcrumb-item active">{{ _('Filters') }}</li>
</ol>
</nav>
<ul class="nav nav-tabs flex-column flex-sm-row card-header-tabs">
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/user/settings">Basic</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link active" href="/user/settings/filters">Blocks & Filters</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link" href="/u/{{ current_user.user_name }}/profile">Profile</a>
</li>
<li class="nav-item">
<a class="flex-sm-fill text-sm-center nav-link disabled" href="#">Other</a>
</li>
</ul>
</div>
<div class="card-body">
<div class="rh_action_buttons">
<a class="btn btn-primary" href="{{ url_for('user.user_settings_filters_add') }}">{{ _('Add filter') }}</a>
</div>
<h1>{{ _('Filters') }}</h1>
<p class="card-text">{{ _('Filters can hide posts that contain keywords you specify, either by making them less noticeable or invisible.') }}</p>
{% if filters %}
<table class="table table-striped" role="table">
<tr>
<th>{{ _('Name') }}</th>
<th>{{ _('Keywords') }}</th>
<th>{{ _('Action') }}</th>
<th>{{ _('Expires') }}</th>
<th> </th>
</tr>
{% for filter in filters %}
<tr>
<td>{{ filter.title }}</td>
<td>{{ filter.keywords_string()|shorten(30) }}</td>
<td>{{ _('Invisible') if filter.hide_type == 1 else _('Semi-transparent') }}</td>
<td>{{ filter.expire_after if filter.expire_after }}</td>
<td>
<a href="{{ url_for('user.user_settings_filters_edit', filter_id=filter.id) }}">Edit</a> |
<a href="{{ url_for('user.user_settings_filters_delete', filter_id=filter.id) }}" class="confirm_first">Delete</a>
</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>{{ _('No filters defined yet.') }}</p>
{% endif %}
<h1>Blocks</h5>
<p class="card-text">Manage what users, communities, domains or instances you want to block. Blocking them means you will no longer see any posts associated with them.</p>
<a class="btn btn-primary" href="">Manage User Blocks</a>
<a class="btn btn-primary" href="">Manage Communities Blocks</a>
<a class="btn btn-primary" href="">Manage Domain Blocks</a>
<a class="btn btn-primary" href="">Manage Instance Blocks</a>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -142,7 +142,7 @@ def edit_profile(actor):
form.matrixuserid.data = current_user.matrix_user_id form.matrixuserid.data = current_user.matrix_user_id
form.password_field.data = '' form.password_field.data = ''
return render_template('user/edit_profile2.html', title=_('Edit profile'), form=form, user=current_user, return render_template('user/edit_profile.html', title=_('Edit profile'), form=form, user=current_user,
markdown_editor=current_user.markdown_editor, markdown_editor=current_user.markdown_editor,
moderating_communities=moderating_communities(current_user.get_id()), moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id()) joined_communities=joined_communities(current_user.get_id())
@ -202,7 +202,7 @@ def change_settings():
form.theme.data = current_user.theme form.theme.data = current_user.theme
form.markdown_editor.data = current_user.markdown_editor form.markdown_editor.data = current_user.markdown_editor
return render_template('user/edit_settings2.html', title=_('Edit profile'), form=form, user=current_user, return render_template('user/edit_settings.html', title=_('Edit profile'), form=form, user=current_user,
moderating_communities=moderating_communities(current_user.get_id()), moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id()) joined_communities=joined_communities(current_user.get_id())
) )
@ -614,11 +614,12 @@ def import_settings_task(user_id, filename):
@login_required @login_required
def user_settings_filters(): def user_settings_filters():
filters = Filter.query.filter_by(user_id=current_user.id).order_by(Filter.title).all() filters = Filter.query.filter_by(user_id=current_user.id).order_by(Filter.title).all()
return render_template('user/filters2.html', filters=filters, user=current_user, return render_template('user/filters.html', filters=filters, user=current_user,
moderating_communities=moderating_communities(current_user.get_id()), moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id()) joined_communities=joined_communities(current_user.get_id())
) )
@bp.route('/user/settings/filters/add', methods=['GET', 'POST']) @bp.route('/user/settings/filters/add', methods=['GET', 'POST'])
@login_required @login_required
def user_settings_filters_add(): def user_settings_filters_add():