-
Notifications
You must be signed in to change notification settings - Fork 354
✨(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
base: main
Are you sure you want to change the base?
Conversation
6168b6c
to
90c4a82
Compare
d39c772
to
c3ded8f
Compare
c3ded8f
to
97248eb
Compare
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
).
There was a problem hiding this comment.
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:
docs/src/frontend/apps/impress/src/features/docs/doc-tree/components/DocTree.tsx
Line 210 in e8147d0
isRoot={true} |
97248eb
to
c55c4fa
Compare
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".
c55c4fa
to
e8147d0
Compare
Purpose
The subdocs can now have their own link reach properties, dissociated from the parent document.
Proposal
Demo
Test.8989.-.Docs.webm