Fix tag collapse state not getting updated

This commit is contained in:
abdo 2021-01-09 17:46:52 +03:00
parent 97b4c2124c
commit 5919d9273f

View file

@ -1320,17 +1320,18 @@ impl BackendService for Backend {
fn set_tag_collapsed(&self, input: pb::SetTagCollapsedIn) -> BackendResult<pb::Bool> { fn set_tag_collapsed(&self, input: pb::SetTagCollapsedIn) -> BackendResult<pb::Bool> {
self.with_col(|col| { self.with_col(|col| {
let name = &input.name; let name = &input.name;
let tag: Result<Tag> = if let Some(tag) = col.storage.get_tag(name)? { let mut tag = if let Some(tag) = col.storage.get_tag(name)? {
Ok(tag) tag
} else { } else {
// tag is missing, register it // tag is missing, register it
let t = Tag { let t = Tag {
name: name.to_owned(), name: name.to_owned(),
..Default::default() ..Default::default()
}; };
Ok(col.register_tag(t)?.0) col.register_tag(t)?.0
}; };
tag?.config.browser_collapsed = input.collapsed; tag.config.browser_collapsed = input.collapsed;
col.update_tag(&tag)?;
Ok(pb::Bool { val: true }) Ok(pb::Bool { val: true })
}) })
} }