Finish adding support for follow requests

This commit is contained in:
Jason McBrayer 2019-03-06 14:26:00 -05:00
parent d3ed8eef27
commit 67f2ea8149
5 changed files with 45 additions and 2 deletions

View File

@ -0,0 +1,19 @@
{% extends "base.html" %}
{% load widget_tweaks %}
{% block content %}
<div class="container">
<h1 class="title">Follow requests</h1>
{% if not requests %}
<p>No follow requests.</p>
{% endif %}
{% for request in requests %}
{% include "requests/request_partial.html" %}
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,21 @@
<article class="media box">
<figure class="media-left">
<p class="image is-64x64">
<img src="{{ request.avatar_static }}"
alt="{{ request.acct }}">
</p>
</figure>
<div class="media-content">
<strong>{{ request.display_name }}</strong> ({{ request.acct }})
</div>
<div class="media-right">
<form method="POST" action="{% url "follow_requests" request.id %}">
{% csrf_token %}
<button name="accept" class="button is-success" value="Accept">
Accept
</button>
<button name="reject" class="button is-danger" value="Reject">
Reject
</button>
</form>
</div>

View File

@ -149,8 +149,9 @@
value="Save" class="button is-primary" >
</div>
</form>
<h2 class="subtitle">Filters and Lists</h2>
<h2 class="subtitle">Filters and More</h2>
<p><a href="{% url "list_filters" %}">List filters</a></p>
<p><a href="{% url "follow_requests" %}">Follow requests</a></p>
</div>
{% endblock %}

View File

@ -64,5 +64,7 @@ urlpatterns = [
path('filters/create', views.create_filter, name='create_filter'),
path('filters/delete/<id>', views.delete_filter, name='delete_filter'),
path('filters/edit/<id>', views.edit_filter, name='edit_filter'),
path('requests/', views.follow_requests, name='follow_requests'),
path('requests/<id>', views.follow_requests, name='follow_requests'),
path('', views.home, name=''),
]

View File

@ -1091,7 +1091,7 @@ def follow_requests(request, id=None):
else:
if request.POST.get("accept", None):
mastodon.follow_request_authorize(id)
elif request.POST.get("rejest", None):
elif request.POST.get("reject", None):
mastodon.follow_request_reject(id)
return redirect(follow_requests)