mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-14 07:51:01 +00:00
Try to use only "absolute" links to avoid trailing-slash bugs
This commit is contained in:
parent
999e91290a
commit
b42030e831
6 changed files with 13 additions and 14 deletions
|
@ -259,8 +259,7 @@ impl Blog {
|
|||
|
||||
pub fn to_json(&self, conn: &PgConnection) -> serde_json::Value {
|
||||
let mut json = serde_json::to_value(self).unwrap();
|
||||
let formatted = serde_json::Value::String(format!("/~/{}",self.get_fqn(conn)));
|
||||
json["fqn"] = formatted;
|
||||
json["fqn"] = json!(self.get_fqn(conn));
|
||||
json
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ fn details_response(blog: String, slug: String, conn: DbConn, user: Option<User>
|
|||
|
||||
Template::render("posts/details", json!({
|
||||
"author": post.get_authors(&*conn)[0].to_json(&*conn),
|
||||
"post": post,
|
||||
"article": post.to_json(&*conn),
|
||||
"blog": blog,
|
||||
"comments": &comments.into_iter().filter_map(|c| if c.in_response_to_id.is_none() {
|
||||
Some(c.to_json(&*conn, &comms))
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<p>{{ "No posts to see here yet." | _ }}</p>
|
||||
{% endif %}
|
||||
{% if is_author %}
|
||||
<a href="new" class="button inline-block">{{ "New article" | _ }}</a>
|
||||
<a href="/~/{{ blog.fqn }}/new/" class="button inline-block">{{ "New article" | _ }}</a>
|
||||
{% endif %}
|
||||
<div class="cards">
|
||||
{% for article in posts %}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
link_4="</a>")
|
||||
}}
|
||||
⋅ {{ article.date | date(format="%B %e") }}
|
||||
⋅ <a href="{{ article.blog.fqn }}">{{ article.blog.title }}</a>
|
||||
⋅ <a href="/~/{{ article.blog.fqn }}/">{{ article.blog.title }}</a>
|
||||
</p>
|
||||
</div>
|
||||
{% endmacro post_card %}
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
{% import "macros" as macros %}
|
||||
|
||||
{% block title %}
|
||||
{{ post.title }}
|
||||
{{ article.post.title }}
|
||||
{% endblock title %}
|
||||
|
||||
{% block header %}
|
||||
<a href="../">{{ blog.title }}</a>
|
||||
<a href="/~/{{ blog.fqn }}">{{ blog.title }}</a>
|
||||
{% endblock header %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="article">{{ post.title }}</h1>
|
||||
<h1 class="article">{{ article.post.title }}</h1>
|
||||
<p class="article-info">
|
||||
<span class="author">{{ "Written by {{ link_1 }}{{ url }}{{ link_2 }}{{ name | escape }}{{ link_3 }}" | _(
|
||||
link_1='<a href="/@/',
|
||||
|
@ -24,15 +24,15 @@
|
|||
<span class="date">{{ date | date(format="%B %e, %Y") }}</span>
|
||||
</p>
|
||||
<article>
|
||||
{{ post.content | safe }}
|
||||
{{ article.post.content | safe }}
|
||||
</article>
|
||||
|
||||
<div class="article-meta">
|
||||
<p>{{ "This article is under the {{ license }} license." | _(license=post.license) }}</p>
|
||||
<p>{{ "This article is under the {{ license }} license." | _(license=article.post.license) }}</p>
|
||||
|
||||
{% if account %}
|
||||
<div class="actions">
|
||||
<form class="likes" action="like" method="POST">
|
||||
<form class="likes" action="{{ article.url }}like" method="POST">
|
||||
<p aria-label="{{ "{{ count }} likes" | _n(singular="One like", count=n_likes) }}" title="{{ "{{ count }} likes" | _n(singular="One like", count=n_likes) }}">{{ n_likes }}</p>
|
||||
|
||||
{% if has_liked %}
|
||||
|
@ -41,7 +41,7 @@
|
|||
<button type="submit"><i class="fa fa-heart"></i>{{ "Add yours" | _ }}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<form class="reshares" action="reshare" method="POST">
|
||||
<form class="reshares" action="{{ article.url }}reshare" method="POST">
|
||||
<p aria-label="{{ "{{ count }} reshares" | _n(singular="One reshare", count=n_reshares) }}" title="{{ "{{ count }} reshares" | _n(singular="One reshare", count=n_reshares) }}">{{ n_reshares }}</p>
|
||||
|
||||
{% if has_reshared %}
|
||||
|
@ -59,7 +59,7 @@
|
|||
<h2>{{ "Comments" | _ }}</h2>
|
||||
|
||||
{% if account %}
|
||||
<form method="post" action="/~/{{ blog.actor_id }}/{{ post.slug }}/comment">
|
||||
<form method="post" action="{{ article.url }}comment">
|
||||
<label for="content">{{ "Your comment" | _ }}</label>
|
||||
{% if previous %}
|
||||
<input type="hidden" name="responding_to" value="{{ previous.id }}"/>
|
||||
|
|
|
@ -32,5 +32,5 @@
|
|||
</div>
|
||||
|
||||
<div>
|
||||
<a href="followers/">{{ "{{ count }} followers" | _n(singular="One follower", count=n_followers) }}</a>
|
||||
<a href="/@/{{ user.fqn }}/followers/">{{ "{{ count }} followers" | _n(singular="One follower", count=n_followers) }}</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue