Skip to content

✨(frontend) subdocs can manage link reach #1190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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 from 97248eb to c55c4fa Compare July 22, 2025 09:39
AntoLC added 2 commits July 22, 2025 11:41
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 c55c4fa to e8147d0 Compare July 22, 2025 09:42
@AntoLC AntoLC requested a review from lunika July 22, 2025 09:48
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