fix: Group tree path
This commit is contained in:
parent
e310930d9e
commit
5224fe78b6
1 changed files with 2 additions and 10 deletions
|
|
@ -47,16 +47,8 @@ class PasswordsController:
|
||||||
return e
|
return e
|
||||||
|
|
||||||
def _node_of_group(self, g: Group) -> NodeDTO:
|
def _node_of_group(self, g: Group) -> NodeDTO:
|
||||||
def group_path(gr: Group) -> str:
|
raw_path = g.path
|
||||||
names: List[str] = []
|
path = "/" + "/".join(raw_path) if raw_path else "/"
|
||||||
cur = gr
|
|
||||||
while cur and cur.name:
|
|
||||||
names.append(cur.name)
|
|
||||||
cur = cur.parent
|
|
||||||
names.reverse()
|
|
||||||
return "/" + "/".join(names) if names else "/"
|
|
||||||
|
|
||||||
path = group_path(g)
|
|
||||||
groups = [self._node_of_group(sg) for sg in g.subgroups]
|
groups = [self._node_of_group(sg) for sg in g.subgroups]
|
||||||
entries = [EntryNodeDTO(
|
entries = [EntryNodeDTO(
|
||||||
kind=EntryKind.complex if (e.username or e.url or e.notes) else EntryKind.simple,
|
kind=EntryKind.complex if (e.username or e.url or e.notes) else EntryKind.simple,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue