From 781fe69470125f888f5c7583db157e0ecc8129f9 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 6 Dec 2021 09:29:51 +1100 Subject: [PATCH] more descriptive remote follow errors - distinguish between invalid username, user not found, and remote follow not supported - make helpers DRYer --- bookwyrm/templates/ostatus/error.html | 28 ++++++++++--- bookwyrm/templates/ostatus/subscribe.html | 6 +-- bookwyrm/views/follow.py | 36 +++++++++++++--- bookwyrm/views/helpers.py | 51 +++++++++++++---------- 4 files changed, 83 insertions(+), 38 deletions(-) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index b5a3bf40..a603529f 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -2,7 +2,28 @@ {% block content %}
- {% if not request.user.is_authenticated and not error == 'remote_subscribe' %} + {% if error == 'invalid_username' %} +
+ {% blocktrans %} +

{{ account }} is not a valid username.

+

Check you have the correct username before trying again.

+ {% endblocktrans %} +
+ {% elif error == 'user_not_found' %} +
+ {% blocktrans %} +

{{ account }} could not be found or {{ remote_domain }} does not support identity discovery.

+

Check you have the correct username before trying again.

+ {% endblocktrans %} +
+ {% elif error == 'not_supported' %} +
+ {% blocktrans %} +

{{ account }} was found but {{ remote_domain }} does not support 'remote follow'.

+

Try searching for {{ user }} on {{ remote_domain }} instead.

+ {% endblocktrans %} +
+ {% elif not request.user.is_authenticated %}