Merge pull request #3797 from jumpserver/dev

[Update] 修复收藏资产数量不对的问题
pull/3882/head
BaiJiangJie 2020-03-19 15:43:44 +08:00 committed by GitHub
commit e8ff576324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -315,10 +315,13 @@ class AssetPermissionUtil(AssetPermissionUtilCacheMixin):
identifier=node_key, tag=node_value,
parent=user_tree.root,
)
node = user_tree.get_node(node_key)
assets_id = FavoriteAsset.get_user_favorite_assets_id(self.object)
all_valid_assets = user_tree.all_valid_assets(user_tree.root)
valid_assets_id = set(assets_id) & all_valid_assets
user_tree.set_assets(node_key, valid_assets_id)
# 必须设置这个,否则看不到个数
node.data['all_assets'] = None
def set_user_tree_to_local(self, user_tree):
self._user_tree = user_tree