diff --git a/brutaldon/templates/main/follow.html b/brutaldon/templates/main/follow.html new file mode 100644 index 0000000..313f50d --- /dev/null +++ b/brutaldon/templates/main/follow.html @@ -0,0 +1,60 @@ +{% extends "base.html" %} +{% load taglinks %} +{% load sanitizer %} + +{% block title %}Brutaldon - confirm (un)follow {% endblock %} + +{% block content %} + {% if relationship.requested %} +

Cancel follow request?

+ {% elif relationship.following %} +

Unfollow this user?

+ {% else %} +

Follow this user?

+ {% endif %} + +
+
+

+ + + +

+
+
+
+

+ {{ user.display_name }} + + + @{{ user.acct }} + + +

+ {{ user.note | relink_toot | strip_html | safe }} +

+

+ +
+
+
+ +
+ {% csrf_token %} +
+
+
+ +
+
+
+
+ +
+
+
+
+ +{% endblock %} diff --git a/brutaldon/views.py b/brutaldon/views.py index c79cfb8..d78778f 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -422,7 +422,23 @@ def delete(request, id): @never_cache def follow(request, id): - pass + mastodon = get_mastodon(request) + try: + user_dict = mastodon.account(id) + relationship = mastodon.account_relationships(user_dict.id)[0] + except IndexError: + raise Http404("The user could not be found.") + if request.method == 'POST': + if not request.POST.get('cancel', None): + if relationship.requested or relationship.following: + mastodon.account_unfollow(id) + else: + mastodon.account_follow(id) + return redirect(user, user_dict.acct) + else: + return render(request, 'main/follow.html', + {"user": user_dict, "relationship": relationship, "confirm_page": True, + 'fullbrutalism': fullbrutalism_p(request)}) @never_cache def block(request, id):