updateOutputNode adds "InsideRecycle" flag by scanning ancestors, if they are present in branch info
(ctx context.Context, node *tree.Node, identifier string)
| 33 | |
| 34 | // updateOutputNode adds "InsideRecycle" flag by scanning ancestors, if they are present in branch info |
| 35 | func (r *RecyclePathHandler) updateOutputNode(ctx context.Context, node *tree.Node, identifier string) (context.Context, *tree.Node, error) { |
| 36 | // Just lookup in cache - do not trigger another load of ancestores |
| 37 | if branchInfo, be := nodes.GetBranchInfo(ctx, identifier); be == nil && branchInfo.AncestorsList != nil { |
| 38 | if ancestors, ok := branchInfo.AncestorsList[node.Path]; ok { |
| 39 | for _, p := range ancestors { |
| 40 | if p.GetUuid() == node.GetUuid() { |
| 41 | continue |
| 42 | } |
| 43 | if p.GetStringMeta(common.MetaNamespaceNodeName) == common.RecycleBinName { |
| 44 | out := node.Clone() |
| 45 | out.MustSetMeta(common.MetaNamespaceInsideRecycle, "true") |
| 46 | return ctx, out, nil |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | return ctx, node, nil |
| 52 | } |