From 3764e295b8eac972935f210f3e12c7f8c779ae8e Mon Sep 17 00:00:00 2001 From: Bat Date: Fri, 20 Jul 2018 17:59:16 +0200 Subject: [PATCH] Fix the link of the follow/unfollow button so that it is always working, even without a trailing slash --- plume.md | 8 -------- src/routes/user.rs | 4 ++-- templates/users/header.html.tera | 4 ++-- 3 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 plume.md diff --git a/plume.md b/plume.md deleted file mode 100644 index 687307f5..00000000 --- a/plume.md +++ /dev/null @@ -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. diff --git a/src/routes/user.rs b/src/routes/user.rs index 8281a701..6b131304 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -42,7 +42,7 @@ fn details(name: String, conn: DbConn, account: Option) -> Template { let n_followers = user.get_followers(&*conn).len(); 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, "is_remote": user.instance_id != Instance::local_id(&*conn), "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) -> Template { let user_id = user.id.clone(); 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, "is_remote": user.instance_id != Instance::local_id(&*conn), "follows": account.clone().map(|x| x.is_following(&*conn, user.id)).unwrap_or(false), diff --git a/templates/users/header.html.tera b/templates/users/header.html.tera index 53864f7c..155081b0 100644 --- a/templates/users/header.html.tera +++ b/templates/users/header.html.tera @@ -21,9 +21,9 @@ {% set not_self = not is_self %} {% if not_self and (account is defined) %} {% if follows %} - {{ "Unfollow" | _ }} + {{ "Unfollow" | _ }} {% else %} - {{ "Follow" | _ }} + {{ "Follow" | _ }} {% endif %} {% endif %}