mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-16 05:06:32 +00:00
show popup for remote follow
This commit is contained in:
parent
6e7d23c1ae
commit
f828f36cc5
3 changed files with 19 additions and 24 deletions
|
@ -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"
|
||||||
|
)
|
||||||
|
}
|
||||||
}();
|
}();
|
||||||
|
|
|
@ -4,13 +4,9 @@
|
||||||
|
|
||||||
<div class="field mb-0">
|
<div class="field mb-0">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<form method="GET" action="{% url 'remote-follow-page' %}" >
|
<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">
|
||||||
{% csrf_token %}
|
{% blocktrans with username=user.localname %}Follow on Fediverse{% endblocktrans %}
|
||||||
<input type="hidden" name="user" value="{{ user.username }}">
|
</a>
|
||||||
<button class="button is-small{% if not minimal %} is-link{% endif %}" type="submit">
|
|
||||||
{% blocktrans with username=user.localname %}Follow on Fediverse{% endblocktrans %}
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -136,11 +136,6 @@ def ostatus_follow_success(request):
|
||||||
|
|
||||||
def remote_follow_page(request):
|
def remote_follow_page(request):
|
||||||
"""Display remote follow page"""
|
"""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"))
|
user = get_user_from_username(request.user, request.GET.get("user"))
|
||||||
data = {
|
data = {
|
||||||
"user": user
|
"user": user
|
||||||
|
@ -154,15 +149,3 @@ def remote_follow(request):
|
||||||
template = subscribe_remote_webfinger(remote_user)
|
template = subscribe_remote_webfinger(remote_user)
|
||||||
url = template.replace("{uri}", request.POST.get("user"))
|
url = template.replace("{uri}", request.POST.get("user"))
|
||||||
return redirect(url)
|
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
|
|
||||||
"""
|
|
||||||
|
|
Loading…
Reference in a new issue