Avoid generating invalid diff links in changes feed
This commit is contained in:
parent
5acca0ddb7
commit
f9905e6548
2 changed files with 14 additions and 9 deletions
|
@ -219,7 +219,7 @@ impl Resource for ChangesResource {
|
||||||
|
|
||||||
_latest: bool,
|
_latest: bool,
|
||||||
|
|
||||||
diff_link: String,
|
diff_link: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Row<'a> {
|
impl<'a> Row<'a> {
|
||||||
|
@ -337,13 +337,18 @@ impl Resource for ChangesResource {
|
||||||
_slug: x.slug,
|
_slug: x.slug,
|
||||||
title: x.title,
|
title: x.title,
|
||||||
_latest: x.latest,
|
_latest: x.latest,
|
||||||
diff_link: format!("_diff/{}?{}",
|
diff_link:
|
||||||
x.article_id,
|
if x.revision > 1 {
|
||||||
diff_resource::QueryParameters::new(
|
Some(format!("_diff/{}?{}",
|
||||||
x.revision as u32 - 1,
|
x.article_id,
|
||||||
x.revision as u32,
|
diff_resource::QueryParameters::new(
|
||||||
)
|
x.revision as u32 - 1,
|
||||||
),
|
x.revision as u32,
|
||||||
|
)
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<td><a href="_revisions/{{.article_id}}/{{.revision}}">{{.title}}</a></td>
|
<td><a href="_revisions/{{.article_id}}/{{.revision}}">{{.title}}</a></td>
|
||||||
<td>{{.created}}</td>
|
<td>{{.created}}</td>
|
||||||
{{#show_authors?}}<td>{{#..author}}<a href="{{...author_link()}}">{{.}}</a>{{/..author}}{{^..author}}<i>Anonymous</i>{{/..author}}</td>{{/show_authors}}
|
{{#show_authors?}}<td>{{#..author}}<a href="{{...author_link()}}">{{.}}</a>{{/..author}}{{^..author}}<i>Anonymous</i>{{/..author}}</td>{{/show_authors}}
|
||||||
<td><a href="{{.diff_link}}">change</a></td>
|
<td>{{#.diff_link}}<a href="{{.}}">change</a>{{/.diff_link}}{{^.diff_link}}new{{/.diff_link}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/changes}}
|
{{/changes}}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue