[Bugfix] 修复节点数量缓存显示不对的bug

pull/3972/head
ibuler 2020-05-08 15:53:58 +08:00
parent 1936a6d5ee
commit 331cfe2aed
2 changed files with 5 additions and 7 deletions

View File

@ -76,14 +76,9 @@ class TreeService(Tree):
ancestor_ids.pop(0)
return ancestor_ids
def ancestors(self, nid, with_self=False, deep=False, with_assets=True):
def ancestors(self, nid, with_self=False, deep=False):
ancestor_ids = self.ancestors_ids(nid, with_self=with_self)
ancestors = [self.get_node(i, deep=deep) for i in ancestor_ids]
if with_assets:
return ancestors
for n in ancestors:
n.data['assets'] = set()
n.data['all_assets'] = None
return ancestors
def get_node_full_tag(self, nid):
@ -108,6 +103,7 @@ class TreeService(Tree):
node = super().get_node(nid)
if deep:
node = self.copy_node(node)
node.data = {}
return node
def parent(self, nid, deep=False):

View File

@ -301,7 +301,6 @@ class AssetPermissionUtil(AssetPermissionUtilCacheMixin):
continue
ancestors = self.full_tree.ancestors(
child.identifier, with_self=False, deep=True,
with_assets=False,
)
if not ancestors:
continue
@ -350,6 +349,9 @@ class AssetPermissionUtil(AssetPermissionUtilCacheMixin):
self.add_favorite_node_if_need(user_tree)
self.set_user_tree_to_cache_if_need(user_tree)
self.set_user_tree_to_local(user_tree)
for n in user_tree.all_nodes():
if n.identifier in ['3', '3:0']:
logger.info('{} - {}'.format(n.tag, n.data))
return user_tree
# Todo: 是否可以获取多个资产的系统用户