perf: 代码优化

pull/6555/head
feng626 2021-07-28 14:33:02 +08:00
parent d0680c3753
commit da588ce0ae
1 changed files with 9 additions and 7 deletions

View File

@ -549,7 +549,9 @@ class UserGrantedNodesQueryUtils(UserGrantedUtilsBase):
return self.get_top_level_nodes() return self.get_top_level_nodes()
nodes = PermNode.objects.none() nodes = PermNode.objects.none()
if key != PermNode.FAVORITE_NODE_KEY: if key == PermNode.FAVORITE_NODE_KEY:
return nodes
node = PermNode.objects.get(key=key) node = PermNode.objects.get(key=key)
granted_status = node.get_granted_status(self.user) granted_status = node.get_granted_status(self.user)
if granted_status == NodeFrom.granted: if granted_status == NodeFrom.granted: