mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
unblock instances
This commit is contained in:
parent
05d603c5a8
commit
18e5301879
5 changed files with 23 additions and 6 deletions
|
@ -605,7 +605,7 @@ def post_edit(post_id: int):
|
|||
post = Post.query.get_or_404(post_id)
|
||||
form = CreatePostForm()
|
||||
del form.communities
|
||||
if post.user_id == current_user.id or post.community.is_moderator():
|
||||
if post.user_id == current_user.id or post.community.is_moderator() or current_user.is_admin():
|
||||
if g.site.enable_nsfl is False:
|
||||
form.nsfl.render_kw = {'disabled': True}
|
||||
if post.community.nsfw:
|
||||
|
|
|
@ -176,7 +176,9 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<p><a href="#" class="btn btn-primary">{{ _('Moderate') }}</a></p>
|
||||
<p><a href="{{ url_for('community.community_edit', community_id=community.id) }}" class="btn btn-primary">{{ _('Settings') }}</a></p>
|
||||
{% if is_owner or is_admin %}
|
||||
<p><a href="{{ url_for('community.community_edit', community_id=community.id) }}" class="btn btn-primary">{{ _('Settings') }}</a></p>
|
||||
{% endif %}
|
||||
{% if community.is_local() and (community.is_owner() or current_user.is_admin()) %}
|
||||
<p><a class="btn btn-primary btn-warning" href="{{ url_for('community.community_delete', community_id=community.id) }}" rel="nofollow">Delete community</a></p>
|
||||
{% endif %}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</ol>
|
||||
</nav>
|
||||
<div class="row">
|
||||
<div class="col col-6">
|
||||
<div class="col-12 col-md-10">
|
||||
<h1 class="mt-2">{{ _('Moderators for %(community)s', community=community.display_name()) }}</h1>
|
||||
</div>
|
||||
<div class="col col-6 text-right">
|
||||
<div class="col-12 col-md-2 text-right">
|
||||
<a class="btn btn-primary" href="{{ url_for('community.community_add_moderator', community_id=community.id) }}">{{ _('Add moderator') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
{% for instance in blocked_instances %}
|
||||
<tr>
|
||||
<td><a href="#">{{ instance.domain }}</a></td>
|
||||
<td><a class="no-underline confirm_first" href="#" rel="nofollow"><span class="fe fe-delete"> {{ _('Unblock') }}</span></a></td>
|
||||
<td><a class="no-underline confirm_first" href="{{ url_for('user.instance_unblock', instance_id=instance.id) }}" rel="nofollow"><span class="fe fe-delete"> {{ _('Unblock') }}</span></a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -18,7 +18,7 @@ from app.user.forms import ProfileForm, SettingsForm, DeleteAccountForm, ReportU
|
|||
from app.user.utils import purge_user_then_delete
|
||||
from app.utils import get_setting, render_template, markdown_to_html, user_access, markdown_to_text, shorten_string, \
|
||||
is_image_url, ensure_directory_exists, gibberish, file_get_contents, community_membership, user_filters_home, \
|
||||
user_filters_posts, user_filters_replies, moderating_communities, joined_communities, theme_list
|
||||
user_filters_posts, user_filters_replies, moderating_communities, joined_communities, theme_list, blocked_instances
|
||||
from sqlalchemy import desc, or_, text
|
||||
import os
|
||||
|
||||
|
@ -387,6 +387,21 @@ def delete_profile(actor):
|
|||
return redirect(goto)
|
||||
|
||||
|
||||
@bp.route('/instance/<int:instance_id>/unblock', methods=['GET'])
|
||||
@login_required
|
||||
def instance_unblock(instance_id):
|
||||
instance = Instance.query.get_or_404(instance_id)
|
||||
existing_block = InstanceBlock.query.filter_by(user_id=current_user.id, instance_id=instance.id).first()
|
||||
if existing_block:
|
||||
db.session.delete(existing_block)
|
||||
db.session.commit()
|
||||
cache.delete_memoized(blocked_instances, current_user.id)
|
||||
flash(f'{instance.domain} has been unblocked.')
|
||||
|
||||
goto = request.args.get('redirect') if 'redirect' in request.args else url_for('user.user_settings_filters')
|
||||
return redirect(goto)
|
||||
|
||||
|
||||
@bp.route('/delete_account', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def delete_account():
|
||||
|
|
Loading…
Add table
Reference in a new issue