mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Buttons for undoing follow requests
This commit is contained in:
parent
546579c231
commit
e9575cae6c
2 changed files with 8 additions and 10 deletions
|
@ -1,18 +1,12 @@
|
|||
{% load i18n %}
|
||||
{% if request.user == user or not request.user.is_authenticated %}
|
||||
{% elif request.user in user.follower_requests.all %}
|
||||
|
||||
<div>
|
||||
{% trans "Follow request already sent." %}
|
||||
</div>
|
||||
|
||||
{% elif user in request.user.blocks.all %}
|
||||
{% include 'snippets/block_button.html' %}
|
||||
{% else %}
|
||||
|
||||
<div class="field has-addons">
|
||||
<div class="control">
|
||||
<form action="/follow/" method="POST" class="interaction follow-{{ user.id }} {% if request.user in user.followers.all %}hidden{%endif %}" data-id="follow-{{ user.id }}">
|
||||
<form action="{% url 'follow' %}" method="POST" class="interaction follow-{{ user.id }} {% if request.user in user.followers.all or request.user in user.follower_requests.all %}hidden{%endif %}" data-id="follow-{{ user.id }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.username }}">
|
||||
{% if user.manually_approves_followers %}
|
||||
|
@ -21,10 +15,14 @@
|
|||
<button class="button is-small is-link" type="submit">{% trans "Follow" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<form action="/unfollow/" method="POST" class="interaction follow-{{ user.id }} {% if not request.user in user.followers.all %}hidden{%endif %}" data-id="follow-{{ user.id }}">
|
||||
<form action="{% url 'unfollow' %}" method="POST" class="interaction follow-{{ user.id }} {% if not request.user in user.followers.all and not request.user in user.follower_requests.all %}hidden{%endif %}" data-id="follow-{{ user.id }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.username }}">
|
||||
{% if user.manually_approves_followers %}
|
||||
<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">{% trans "Unfollow" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
<div class="control">
|
||||
|
|
|
@ -188,8 +188,8 @@ urlpatterns = [
|
|||
re_path(r"^start-reading/(?P<book_id>\d+)/?$", views.start_reading),
|
||||
re_path(r"^finish-reading/(?P<book_id>\d+)/?$", views.finish_reading),
|
||||
# following
|
||||
re_path(r"^follow/?$", views.follow),
|
||||
re_path(r"^unfollow/?$", views.unfollow),
|
||||
re_path(r"^follow/?$", views.follow, name="follow"),
|
||||
re_path(r"^unfollow/?$", views.unfollow, name="unfollow"),
|
||||
re_path(r"^accept-follow-request/?$", views.accept_follow_request),
|
||||
re_path(r"^delete-follow-request/?$", views.delete_follow_request),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
|
Loading…
Reference in a new issue