Include domain when generating diff link (fixes #23)

This commit is contained in:
Felix Ableitner 2024-03-14 10:25:16 +01:00
parent 7c7068b619
commit 8188296b88
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ use crate::frontend::{
user_link,
};
use leptos::*;
use crate::frontend::extract_domain;
#[component]
pub fn ArticleHistory() -> impl IntoView {
@ -19,7 +20,7 @@ pub fn ArticleHistory() -> impl IntoView {
<h1>{article_title(&article.article)}</h1>
{
article.edits.into_iter().rev().map(|edit| {
let path = format!("/article/{}/diff/{}", article.article.title, edit.edit.hash.0);
let path = format!("/article/{}@{}/diff/{}", article.article.title, extract_domain(&article.article.ap_id), edit.edit.hash.0);
let label = format!("{} ({})", edit.edit.summary, edit.edit.created.to_rfc2822());
view! {<li><a href={path}>{label}</a>" by "{user_link(&edit.creator)}</li> }
}).collect::<Vec<_>>()