mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Merge pull request 'reworking domains view' (#91) from rscmbbng/pyfedi:domains into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/91
This commit is contained in:
commit
60971ab754
10 changed files with 376 additions and 34 deletions
|
@ -62,11 +62,39 @@ def 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.is_anonymous:
|
||||||
|
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.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)
|
next_url=next_url, prev_url=prev_url, search=search, ban_visibility_permission=ban_visibility_permission)
|
||||||
|
|
||||||
|
@bp.route('/domains/banned', methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
def blocked_domains():
|
||||||
|
page = request.args.get('page', 1, type=int)
|
||||||
|
search = request.args.get('search', '')
|
||||||
|
|
||||||
|
domains = Domain.query.filter_by(banned=True)
|
||||||
|
if search != '':
|
||||||
|
domains = domains.filter(Domain.name.ilike(f'%{search}%'))
|
||||||
|
domains = domains.order_by(Domain.name)
|
||||||
|
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
|
||||||
|
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,
|
||||||
|
next_url=next_url, prev_url=prev_url, search=search, ban_visibility_permission=ban_visibility_permission)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/d/<int:domain_id>/block')
|
@bp.route('/d/<int:domain_id>/block')
|
||||||
|
|
|
@ -1288,4 +1288,15 @@ fieldset legend {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (orientation: portrait) {
|
||||||
|
.flex-sm-fill.text-sm-center.nav-link.active{
|
||||||
|
border-bottom: var(--bs-nav-tabs-border-width) solid var(--bs-border-color);
|
||||||
|
border-bottom-right-radius: var(--bs-nav-tabs-border-radius);
|
||||||
|
border-bottom-left-radius: var(--bs-nav-tabs-border-radius);
|
||||||
|
}
|
||||||
|
.card-header-tabs {
|
||||||
|
margin-bottom:8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=structure.css.map */
|
/*# sourceMappingURL=structure.css.map */
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
||||||
<div class="card mt-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>{{ community.title }}</h2>
|
<h2>{{ community.title }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,34 +6,56 @@
|
||||||
{% from 'bootstrap/form.html' import render_form %}
|
{% from 'bootstrap/form.html' import render_form %}
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
<div class="row">
|
<div class="card col-md-8" style="max-width:unset;">
|
||||||
<div class="col-12 col-md-8 position-relative main_pane">
|
<div class="card-header">
|
||||||
<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 active">Domains</li>
|
<li class="breadcrumb-item active">Domains</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</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 == '' %}
|
||||||
<h1 class="mt-2">{{ _('All known domains') }}</h1>
|
<p class="card-text">All domains this instance knows about</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1 class="mt-2">{{ _('Domains containing %(search)s', search=search) }}</h1>
|
<p class="card-text">Domains containing "{{ _('%(search)s', search=search) }}"</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<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 class="table-responsive-sm">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<tr>
|
||||||
|
<th>Domain</th>
|
||||||
|
<th><span title="{{ _('How many times has something on this domain been posted?') }}"># Posts</span></th>
|
||||||
|
{% if not current_user.is_anonymous %}{% if user_access('ban users', current_user.id) or user_access('manage users', current_user.id) %}<th>Actions</th>{%endif%}{%endif%}
|
||||||
|
</tr>
|
||||||
|
{% for domain in domains %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ _('Domain') }}</th>
|
<td><a href="{{ url_for('domain.show_domain', domain_id=domain.id) }}">{{ domain.name }}</a></td>
|
||||||
|
<td>{{ domain.post_count }}</td>
|
||||||
|
{% if not current_user.is_anonymous %}
|
||||||
|
{% if user_access('ban users', current_user.id) or user_access('manage users', current_user.id) %}
|
||||||
|
<td>
|
||||||
|
<a class="confirm_first btn btn-primary" 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>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
{% endfor %}
|
||||||
<tbody>
|
|
||||||
{% for domain in domains %}
|
|
||||||
<tr>
|
|
||||||
<th><a href="{{ url_for('domain.show_domain', domain_id=domain.id) }}">{{ domain.name }}</a></th>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
<nav aria-label="Pagination" class="mt-4" role="navigation">
|
<nav aria-label="Pagination" class="mt-4" role="navigation">
|
||||||
{% if prev_url %}
|
{% if prev_url %}
|
||||||
<a href="{{ prev_url }}" class="btn btn-primary" rel="nofollow">
|
<a href="{{ prev_url }}" class="btn btn-primary" rel="nofollow">
|
||||||
|
@ -46,14 +68,8 @@
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</nav>
|
</nav>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
|
||||||
|
|
||||||
</aside>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
77
app/templates/domain/domains_banned.html
Normal file
77
app/templates/domain/domains_banned.html
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
{% 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">←</span> {{ _('Previous page') }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if next_url %}
|
||||||
|
<a href="{{ next_url }}" class="btn btn-primary" rel="nofollow">
|
||||||
|
{{ _('Next page') }} <span aria-hidden="true">→</span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
77
app/templates/user/edit_profile2.html
Normal file
77
app/templates/user/edit_profile2.html
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
{% 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 %}
|
59
app/templates/user/edit_settings2.html
Normal file
59
app/templates/user/edit_settings2.html
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{% 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 %}
|
76
app/templates/user/filters2.html
Normal file
76
app/templates/user/filters2.html
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
{% 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 %}
|
|
@ -108,7 +108,7 @@
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
||||||
{% if current_user.is_authenticated and current_user.id == user.id %}
|
{% if current_user.is_authenticated and current_user.id == user.id %}
|
||||||
<div class="card">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>{{ _('Manage') }}</h2>
|
<h2>{{ _('Manage') }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if len(subscribed) > 0 or len(moderates) > 0 %}
|
{% if len(subscribed) > 0 or len(moderates) > 0 %}
|
||||||
<div class="card mt-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>{{ _('Communities') }}</h2>
|
<h2>{{ _('Communities') }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.is_authenticated and (user_access('ban users', current_user.id) or user_access('manage users', current_user.id)) and user.id != current_user.id %}
|
{% if current_user.is_authenticated and (user_access('ban users', current_user.id) or user_access('manage users', current_user.id)) and user.id != current_user.id %}
|
||||||
<div class="card mt-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>{{ _('Crush') }}</h2>
|
<h2>{{ _('Crush') }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if upvoted %}
|
{% if upvoted %}
|
||||||
<div class="card mt-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>{{ _('Upvoted') }}</h2>
|
<h2>{{ _('Upvoted') }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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_profile.html', title=_('Edit profile'), form=form, user=current_user,
|
return render_template('user/edit_profile2.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,12 +202,11 @@ 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_settings.html', title=_('Edit profile'), form=form, user=current_user,
|
return render_template('user/edit_settings2.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())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/u/<actor>/ban', methods=['GET'])
|
@bp.route('/u/<actor>/ban', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def ban_profile(actor):
|
def ban_profile(actor):
|
||||||
|
@ -615,12 +614,11 @@ 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/filters.html', filters=filters, user=current_user,
|
return render_template('user/filters2.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():
|
||||||
|
|
Loading…
Add table
Reference in a new issue