fix(web): dont include summary if empty
This commit is contained in:
parent
64d7f25aa2
commit
505bdfa234
1 changed files with 3 additions and 3 deletions
|
@ -86,7 +86,7 @@ pub fn PostBox(advanced: WriteSignal<bool>) -> impl IntoView {
|
||||||
<button class="w-100" prop:disabled=posting type="button" style="height: 3em" on:click=move |_| {
|
<button class="w-100" prop:disabled=posting type="button" style="height: 3em" on:click=move |_| {
|
||||||
set_posting.set(true);
|
set_posting.set(true);
|
||||||
spawn_local(async move {
|
spawn_local(async move {
|
||||||
let summary = summary_ref.get().map(|x| x.value());
|
let summary = get_if_some(summary_ref);
|
||||||
let content = content_ref.get().map(|x| x.value()).unwrap_or_default();
|
let content = content_ref.get().map(|x| x.value()).unwrap_or_default();
|
||||||
let (to, cc) = if get_checked(public_ref) {
|
let (to, cc) = if get_checked(public_ref) {
|
||||||
(apb::Node::links(vec![apb::target::PUBLIC.to_string()]), apb::Node::links(vec![format!("{URL_BASE}/users/{}/followers", auth.username())]))
|
(apb::Node::links(vec![apb::target::PUBLIC.to_string()]), apb::Node::links(vec![format!("{URL_BASE}/users/{}/followers", auth.username())]))
|
||||||
|
@ -266,14 +266,14 @@ pub fn AdvancedPostBox(advanced: WriteSignal<bool>) -> impl IntoView {
|
||||||
|
|
||||||
fn get_if_some(node: NodeRef<html::Input>) -> Option<String> {
|
fn get_if_some(node: NodeRef<html::Input>) -> Option<String> {
|
||||||
node.get()
|
node.get()
|
||||||
.filter(|x| !x.value().is_empty())
|
|
||||||
.map(|x| x.value())
|
.map(|x| x.value())
|
||||||
|
.filter(|x| !x.is_empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_vec_if_some(node: NodeRef<html::Input>) -> Vec<String> {
|
fn get_vec_if_some(node: NodeRef<html::Input>) -> Vec<String> {
|
||||||
node.get()
|
node.get()
|
||||||
.filter(|x| !x.value().is_empty())
|
|
||||||
.map(|x| x.value())
|
.map(|x| x.value())
|
||||||
|
.filter(|x| !x.is_empty())
|
||||||
.map(|x|
|
.map(|x|
|
||||||
x.split(',')
|
x.split(',')
|
||||||
.map(|x| x.to_string())
|
.map(|x| x.to_string())
|
||||||
|
|
Loading…
Reference in a new issue