Fix the link of the follow/unfollow button so that it is always working, even without a trailing slash

This commit is contained in:
Bat 2018-07-20 17:59:16 +02:00
parent b0e75f4d63
commit 3764e295b8
3 changed files with 4 additions and 12 deletions

View File

@ -1,8 +0,0 @@
Page de présentation Plume
Plume
Moteur de blog décentralisé.
Les auteurs peuvent gérer différents blogs au sein d'un même site.
Les articles sont également visibles sur d'autres sites Plume et vous pouvez interagir avec eux directement depuis d'autres plateformes telles que Mastodon.

View File

@ -42,7 +42,7 @@ fn details(name: String, conn: DbConn, account: Option<User>) -> Template {
let n_followers = user.get_followers(&*conn).len(); let n_followers = user.get_followers(&*conn).len();
Template::render("users/details", json!({ Template::render("users/details", json!({
"user": serde_json::to_value(user.clone()).unwrap(), "user": user.to_json(&*conn),
"instance_url": user.get_instance(&*conn).public_domain, "instance_url": user.get_instance(&*conn).public_domain,
"is_remote": user.instance_id != Instance::local_id(&*conn), "is_remote": user.instance_id != Instance::local_id(&*conn),
"follows": account.clone().map(|x| x.is_following(&*conn, user.id)).unwrap_or(false), "follows": account.clone().map(|x| x.is_following(&*conn, user.id)).unwrap_or(false),
@ -100,7 +100,7 @@ fn followers(name: String, conn: DbConn, account: Option<User>) -> Template {
let user_id = user.id.clone(); let user_id = user.id.clone();
Template::render("users/followers", json!({ Template::render("users/followers", json!({
"user": serde_json::to_value(user.clone()).unwrap(), "user": user.to_json(&*conn),
"instance_url": user.get_instance(&*conn).public_domain, "instance_url": user.get_instance(&*conn).public_domain,
"is_remote": user.instance_id != Instance::local_id(&*conn), "is_remote": user.instance_id != Instance::local_id(&*conn),
"follows": account.clone().map(|x| x.is_following(&*conn, user.id)).unwrap_or(false), "follows": account.clone().map(|x| x.is_following(&*conn, user.id)).unwrap_or(false),

View File

@ -21,9 +21,9 @@
{% set not_self = not is_self %} {% set not_self = not is_self %}
{% if not_self and (account is defined) %} {% if not_self and (account is defined) %}
{% if follows %} {% if follows %}
<a href="follow/" class="inline-block button">{{ "Unfollow" | _ }}</a> <a href="/@/{{ user.fqn }}/follow/" class="inline-block button">{{ "Unfollow" | _ }}</a>
{% else %} {% else %}
<a href="follow/" class="inline-block button">{{ "Follow" | _ }}</a> <a href="/@/{{ user.fqn }}/follow/" class="inline-block button">{{ "Follow" | _ }}</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>