show popup for remote follow

This commit is contained in:
Hugh Rundle 2021-11-28 21:16:57 +11:00
parent 6e7d23c1ae
commit f828f36cc5
No known key found for this signature in database
GPG key ID: CD23D6039184286B
3 changed files with 19 additions and 24 deletions

View file

@ -368,4 +368,20 @@ let BookWyrm = new class {
);
}
}
/**
* Display pop up window.
*
* @param {string} url Url to open
* @param {string} windowName windowName
* @return {undefined}
*/
displayPopUp(url, windowName){
window.open(
url,
windowName,
"left=100,top=100,width=430,height=600"
)
}
}();

View file

@ -4,13 +4,9 @@
<div class="field mb-0">
<div class="control">
<form method="GET" action="{% url 'remote-follow-page' %}" >
{% csrf_token %}
<input type="hidden" name="user" value="{{ user.username }}">
<button class="button is-small{% if not minimal %} is-link{% endif %}" type="submit">
<a class="button is-small is-link" href="{% url 'remote-follow-page' %}?user={{ user.username }}" target="_blank" rel="noopener noreferrer" onclick="BookWyrm.displayPopUp(`{% url 'remote-follow-page' %}?user={{ user.username }}`, `remoteFollow`); return false">
{% blocktrans with username=user.localname %}Follow on Fediverse{% endblocktrans %}
</button>
</form>
</a>
</div>
</div>
{% endif %}

View file

@ -136,11 +136,6 @@ def ostatus_follow_success(request):
def remote_follow_page(request):
"""Display remote follow page"""
# this is triggered from remote follow form
# attempt the follow request
# on success [[return success page]]
# on fail return [[ostatus_error]]
user = get_user_from_username(request.user, request.GET.get("user"))
data = {
"user": user
@ -154,15 +149,3 @@ def remote_follow(request):
template = subscribe_remote_webfinger(remote_user)
url = template.replace("{uri}", request.POST.get("user"))
return redirect(url)
"""
REQUEST TO FOLLOW FROM REMOTE ACCOUNT
1. click remote follow button [default checked option to open new window]
2. popup new small window
REQUEST TO FOLLOW FROM LOCAL ACCOUNT
4. send follow request, on 200 response display success else display error
5. Include button inviting to close window
"""