moviewyrm/bookwyrm/templates/snippets/add_to_group_button.html
Hugh Rundle fb823189a0 don't allow non-local users to join groups (yet)
Groups are not compatible with ActivityPub because I don't know what I'm doing.

NOTE: this is super hacky, fix ASAP
2021-09-27 21:48:40 +10:00

52 lines
2.4 KiB
HTML

{% load i18n %}
{% if request.user == user or not request.user == group.user or not request.user.is_authenticated %}
{% elif user in request.user.blocks.all %}
{% include 'snippets/block_button.html' with blocks=True %}
{% else %}
<div class="field{% if not minimal %} has-addons{% else %} mb-0{% endif %}">
<div class="control">
<form action="{% url 'add-group-member' %}" method="POST" class="interaction add_{{ user.id }} {% if user in group.members.all %}is-hidden{%endif %}" data-id="add_{{ user.id }}">
{% csrf_token %}
<input type="hidden" name="group" value="{{ group.id }}">
<input type="hidden" name="user" value="{{ user.username }}">
{% if user.local %}
<button class="button is-small{% if not minimal %} is-link{% endif %}" type="submit">
{% if show_username %}
{% blocktrans with username=user.localname %}Add @{{ username }}{% endblocktrans %}
{% else %}
{% trans "Add" %}
{% endif %}
</button>
{% else %}
<!-- TODO: This is an incredibly ugly hack until group are AP enabled -->
<span><em>Remote User</em></span>
{% endif %}
</form>
<form action="{% url 'remove-group-member' %}" method="POST" class="interaction add_{{ user.id }} {% if user not in group.members.all %}is-hidden{%endif %}" data-id="add_{{ user.id }}">
{% csrf_token %}
<input type="hidden" name="group" value="{{ group.id }}">
<input type="hidden" name="user" value="{{ user.username }}">
{% if user.manually_approves_followers and request.user not in user.followers.all %}
<button class="button is-small is-danger is-light" type="submit">
{% trans "Undo follow request" %}
</button>
{% else %}
<button class="button is-small is-danger is-light" type="submit">
{% if show_username %}
{% blocktrans with username=user.localname %}Remove @{{ username }}{% endblocktrans %}
{% else %}
{% trans "Remove" %}
{% endif %}
</button>
{% endif %}
</form>
</div>
{% if not minimal %}
<div class="control">
{% include 'snippets/user_options.html' with user=user class="is-small" %}
</div>
{% endif %}
</div>
{% endif %}