mirror of
https://github.com/Nutomic/ibis.git
synced 2025-01-24 14:35:50 +00:00
Dont show edit federation warning for local articles
This commit is contained in:
parent
0e5896eab3
commit
8a18698bfd
1 changed files with 8 additions and 8 deletions
|
@ -136,6 +136,9 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
}
|
}
|
||||||
set_content.set(article.article.text.clone());
|
set_content.set(article.article.text.clone());
|
||||||
let article_ = article.clone();
|
let article_ = article.clone();
|
||||||
|
let show_federation_warning = !article.instance.local
|
||||||
|
&& article.instance.last_refreshed_at + Days::new(3)
|
||||||
|
< Utc::now();
|
||||||
view! {
|
view! {
|
||||||
// set initial text, otherwise submit with no changes results in empty text
|
// set initial text, otherwise submit with no changes results in empty text
|
||||||
<div>
|
<div>
|
||||||
|
@ -145,17 +148,14 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
.map(|err| {
|
.map(|err| {
|
||||||
view! { <p class="alert alert-error">{err}</p> }
|
view! { <p class="alert alert-error">{err}</p> }
|
||||||
})
|
})
|
||||||
}}
|
}} <Show when=move || show_federation_warning>
|
||||||
<Show when=move || {
|
|
||||||
article.instance.last_refreshed_at + Days::new(3)
|
|
||||||
< Utc::now()
|
|
||||||
}>
|
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
This article is hosted on {article.instance.domain.clone()}
|
"This article is hosted on "
|
||||||
which hasnt been federated in
|
{article.instance.domain.clone()}
|
||||||
|
" which hasnt been federated in "
|
||||||
{(Utc::now() - article.instance.last_refreshed_at)
|
{(Utc::now() - article.instance.last_refreshed_at)
|
||||||
.num_days()}
|
.num_days()}
|
||||||
days. Edits will most likely fail. Instead consider forking the article to your local instance (under Actions), or edit a different article.
|
" days. Edits will most likely fail. Instead consider forking the article to your local instance (under Actions), or edit a different article."
|
||||||
</div>
|
</div>
|
||||||
</Show> <EditorView textarea_ref content set_content />
|
</Show> <EditorView textarea_ref content set_content />
|
||||||
<div class="flex flex-row mr-2">
|
<div class="flex flex-row mr-2">
|
||||||
|
|
Loading…
Reference in a new issue