-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Mention-grants: Collaborator-based cross-space access for @-mentions #10895
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
MichaelUray
wants to merge
36
commits into
hcengineering:develop
Choose a base branch
from
MichaelUray:feat/huly-mention-grants
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 33 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
eb35ef9
feat(core): add ClassCollaborators.mentionsGrantAccess opt-in flag
MichaelUray 1d4017e
feat(model/core): wire mentionsGrantAccess into TClassCollaborators m…
MichaelUray 0b9fa6a
feat(tracker): opt tracker.class.Issue into collaborator-grants-read …
MichaelUray 2d28f4b
feat(core/collaborators): add isomorphic resolveMentionGrantTarget he…
MichaelUray b67689c
feat(middleware/guest-permissions): veto field updates from collab-on…
MichaelUray be38db3
feat(tracker/utils): split canEditIssue into canEditIssueFields + can…
MichaelUray f07d6e0
feat(tracker/EditIssue): show comment composer separately from field …
MichaelUray 863faf7
fix(chunter-resources): add @hcengineering/text-core dependency
MichaelUray 961e33c
feat(chunter-trigger): mention-grants-access uses shared helper + gra…
MichaelUray d886ee0
feat(chunter/ChatMessageInput): warn before mention auto-grants Issue…
MichaelUray f5157a0
feat(middleware/spaceSecurity): let Guests read collab-secured docs a…
MichaelUray e6f6fcf
feat(security): allow non-System callers to read their own Collaborat…
MichaelUray bc25a70
feat(security+nav): list collab-only spaces in workbench navigator fo…
MichaelUray 30ad68d
fix(nav): surface collab-only projects in tracker nav-tree
MichaelUray 2c916a2
fix(tracker/nav): hide non-Issues sub-nodes on non-member projects
MichaelUray 28a25d1
feat(tracker/nav): V1 - badge + tooltip for collab-only projects
MichaelUray 8069e28
test(tracker): V2 - mention-grant persists after issue moves to Done
MichaelUray dc3e380
feat(text-core): V3a - grantsAccess attr on mention references
MichaelUray ddb5018
feat(chunter): V3b - per-grantee grant choices in send disclosure
MichaelUray b72c062
feat(chunter-trigger): V3c - honour grantsAccess='false' on mentions
MichaelUray 1a8f324
feat(chunter-trigger): V3d - add-only re-grant on message edit
MichaelUray 765da62
fix(chunter-trigger): V3d update-grant uses the edit actor + add tests
MichaelUray f9fe39f
fix(chunter): preserve unsent comment when grant dialog is cancelled
MichaelUray 2f66577
test(middleware): stub hierarchy.getAncestors for guest-permission un…
MichaelUray d388c5a
fix(workbench-resources/Navigator): correct activeClasses cast to Ref…
MichaelUray 4a73a17
fix: self-review BLOCKERs + IMPORTANT findings
MichaelUray 34c8338
fix(tracker/V1): guard space.members against null
MichaelUray caf9ebc
docs(tracker/V1): note scope limit on sub-node hide
MichaelUray a8765c9
chore: apply repo formatting and lint fixes after develop merge
MichaelUray a1bb75b
fix(middleware): backend-guard collab-read space-filter bypass (H5)
MichaelUray 97d5447
fix(middleware): collab-only Write-Veto deckt auch TxRemoveDoc (L-RM)
MichaelUray ec05335
fix(middleware): guestPermissions fail-closed bei fehlendem Space (L-GP)
MichaelUray 93c13b4
fix(chunter-resources): align text-core to workspace:^0.7.19
MichaelUray 017942d
fix(core): pass limit:1 in resolveMentionGrantTarget lookups
MichaelUray f8aae31
fix(server-chunter): dedup mention grants against in-flight collabora…
MichaelUray fc9c20b
fix(tracker-assets): add ru translation for SharedWithYouTooltip
MichaelUray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
foundations/core/packages/text-core/src/markup/__tests__/reference.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { extractReferences } from '../reference' | ||
| import { MarkupNodeType, type MarkupNode } from '../model' | ||
|
|
||
| function refNode (id: string, label: string, objectclass: string, grantsAccess?: 'true' | 'false'): MarkupNode { | ||
| return { | ||
| type: MarkupNodeType.reference, | ||
| attrs: { id, label, objectclass, ...(grantsAccess !== undefined ? { grantsAccess } : {}) } | ||
| } | ||
| } | ||
|
|
||
| function doc (...children: MarkupNode[]): MarkupNode { | ||
| return { type: MarkupNodeType.doc, content: children } | ||
| } | ||
|
|
||
| describe('extractReferences grantsAccess', () => { | ||
| test('surfaces grantsAccess from a reference node', () => { | ||
| const refs = extractReferences(doc(refNode('p1', 'Alice', 'contact:class:Person', 'true'))) | ||
| expect(refs).toHaveLength(1) | ||
| expect(refs[0].objectId).toBe('p1') | ||
| expect(refs[0].grantsAccess).toBe('true') | ||
| }) | ||
|
|
||
| test('grantsAccess undefined when attr absent (default = grant)', () => { | ||
| const refs = extractReferences(doc(refNode('p1', 'Alice', 'contact:class:Person'))) | ||
| expect(refs[0].grantsAccess).toBeUndefined() | ||
| }) | ||
|
|
||
| test('any-wins: false then true => true', () => { | ||
| const refs = extractReferences( | ||
| doc( | ||
| refNode('p1', 'Alice', 'contact:class:Person', 'false'), | ||
| refNode('p1', 'Alice', 'contact:class:Person', 'true') | ||
| ) | ||
| ) | ||
| expect(refs).toHaveLength(1) | ||
| expect(refs[0].grantsAccess).toBe('true') | ||
| }) | ||
|
|
||
| test('any-wins: true then false => true', () => { | ||
| const refs = extractReferences( | ||
| doc( | ||
| refNode('p1', 'Alice', 'contact:class:Person', 'true'), | ||
| refNode('p1', 'Alice', 'contact:class:Person', 'false') | ||
| ) | ||
| ) | ||
| expect(refs[0].grantsAccess).toBe('true') | ||
| }) | ||
|
|
||
| test('any-wins: false then undefined => not false (undefined grants)', () => { | ||
| const refs = extractReferences( | ||
| doc(refNode('p1', 'Alice', 'contact:class:Person', 'false'), refNode('p1', 'Alice', 'contact:class:Person')) | ||
| ) | ||
| expect(refs[0].grantsAccess).not.toBe('false') | ||
| }) | ||
|
|
||
| test('all explicitly false => false', () => { | ||
| const refs = extractReferences( | ||
| doc( | ||
| refNode('p1', 'Alice', 'contact:class:Person', 'false'), | ||
| refNode('p1', 'Alice', 'contact:class:Person', 'false') | ||
| ) | ||
| ) | ||
| expect(refs[0].grantsAccess).toBe('false') | ||
| }) | ||
|
|
||
| test('different persons kept separate', () => { | ||
| const refs = extractReferences( | ||
| doc(refNode('p1', 'Alice', 'contact:class:Person', 'true'), refNode('p2', 'Bob', 'contact:class:Person', 'false')) | ||
| ) | ||
| expect(refs).toHaveLength(2) | ||
| expect(refs.find((r) => r.objectId === 'p1')?.grantsAccess).toBe('true') | ||
| expect(refs.find((r) => r.objectId === 'p2')?.grantsAccess).toBe('false') | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think it is better to add
limit: 1if only one item is required.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.
Applied. Both
[0]lookups inresolveMentionGrantTargetnow uselimit: 1, withFindOptionsforwarded through all three callers. I also bounded the equivalenttargetClassCollablookup in the trigger.