mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Add option for admins to kick remote subscribers from local communities
(unsubscribe without ban, typically because their instance is dead)
This commit is contained in:
parent
2de2f9ed2d
commit
db250b6aeb
2 changed files with 24 additions and 1 deletions
|
@ -1403,6 +1403,26 @@ def community_moderate_subscribers(actor):
|
|||
abort(404)
|
||||
|
||||
|
||||
@bp.route('/community/<int:community_id>/<int:user_id>/kick_user_community', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def community_kick_user(community_id: int, user_id: int):
|
||||
community = Community.query.get_or_404(community_id)
|
||||
user = User.query.get_or_404(user_id)
|
||||
|
||||
if community is not None:
|
||||
if current_user.is_admin():
|
||||
|
||||
db.session.query(CommunityMember).filter_by(user_id=user_id, community_id=community.id).delete()
|
||||
db.session.commit()
|
||||
|
||||
else:
|
||||
abort(401)
|
||||
else:
|
||||
abort(404)
|
||||
|
||||
return redirect(url_for('community.community_moderate_subscribers', actor=community.name))
|
||||
|
||||
|
||||
@bp.route('/<actor>/moderate/wiki', methods=['GET'])
|
||||
@login_required
|
||||
def community_wiki_list(actor):
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
<li><a class="dropdown-item" href="/u/{{ user.link() }}/report">Report</a></li>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li><a class="dropdown-item" href="{{ url_for('community.community_ban_user', community_id=community.id, user_id=user.id) }}" class="confirm_first">{{ _('Ban') }}</a></li>
|
||||
{% if current_user.is_admin() and community.is_local() and not user.is_local() %}
|
||||
<li><a class="dropdown-item confirm_first" href="{{ url_for('community.community_kick_user', community_id=community.id, user_id=user.id) }}">{{ _('Kick') }}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -126,4 +129,4 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue