Skip to content

Conversation

AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Jul 16, 2025

Purpose

The subdocs can now have their own link reach properties, dissociated from the parent document.

Proposal

  • ✨(frontend) subdocs can manage link reach

Demo

Test.8989.-.Docs.webm

@AntoLC AntoLC self-assigned this Jul 16, 2025
@AntoLC AntoLC force-pushed the refacto/link-reach-subdocs branch from 6168b6c to 90c4a82 Compare July 17, 2025 10:30
@AntoLC AntoLC marked this pull request as ready for review July 17, 2025 10:31
@AntoLC AntoLC changed the title ♻️(frontend) subdocs can manage link reach ✨(frontend) subdocs can manage link reach Jul 17, 2025
@AntoLC AntoLC force-pushed the refacto/link-reach-subdocs branch 2 times, most recently from d39c772 to c3ded8f Compare July 17, 2025 10:35
@AntoLC AntoLC requested a review from lunika July 17, 2025 10:36
@AntoLC AntoLC linked an issue Jul 17, 2025 that may be closed by this pull request
@virgile-dev virgile-dev self-requested a review July 18, 2025 10:01
@AntoLC AntoLC force-pushed the refacto/link-reach-subdocs branch from c3ded8f to 97248eb Compare July 21, 2025 09:52
isCurrentParent: treeContext?.root?.id === doc.id || doc.depth === 1, // it can be a child but not for the current user
isTopParent: doc.depth === 1,
isChild: doc.depth > 1,
isCurrentTopParent: typeof doc.children === 'undefined', // it can be a child but not for the current user
Copy link
Member

@lunika lunika Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a doc has no children, it can't be a parent. Not sure to understand what you are looking for.

Copy link
Collaborator Author

@AntoLC AntoLC Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to know if a doc is the current root, the problem is, a child can be a root for another user, so doc.depth === 1 cannot work in some cases:

Parent -> restricted
├─Child -> Public

If I share the Child link to a anonymous user, Child will be a root for this anonymous user, with doc.depth === 2.
The only variable available to know if a doc is the current tree root, is with the property children apparently.

If you can make me a clean backend property it will be nice though (ex: doc.is_root).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc response came from the endpoint documents/[DOC_ID]/, it is why it was without child array.

There is not a reliable way to know if a doc is the top root without context, I use another way to get the information that I need so:

@AntoLC AntoLC force-pushed the refacto/link-reach-subdocs branch 2 times, most recently from c55c4fa to e8147d0 Compare July 22, 2025 09:42
@AntoLC AntoLC requested a review from lunika July 22, 2025 09:48
@AntoLC AntoLC force-pushed the refacto/link-reach-subdocs branch from e8147d0 to 4fb9984 Compare July 25, 2025 10:08
AntoLC added 2 commits July 25, 2025 12:22
The subdocs can now have their own link reach
properties, dissociated from the parent document.
Using the treeContext was causing issues with
the current parent detection, in many places
the context is not available.
"depth" property is more reliable than
"nb_accesses_ancestors".
@AntoLC AntoLC force-pushed the refacto/link-reach-subdocs branch from 4fb9984 to 3ff6d25 Compare July 25, 2025 10:24
@AntoLC AntoLC merged commit 3ff6d25 into main Jul 25, 2025
20 of 21 checks passed
@AntoLC AntoLC deleted the refacto/link-reach-subdocs branch July 25, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link reach bug on subdocs
3 participants