feat(threaded-annotations): Bump to 1.89.1 with edit, copy link, reply permissions#752
Open
jackiejou wants to merge 5 commits into
Open
feat(threaded-annotations): Bump to 1.89.1 with edit, copy link, reply permissions#752jackiejou wants to merge 5 commits into
jackiejou wants to merge 5 commits into
Conversation
Also bumps the @box/* peer ranges (blueprint-web, blueprint-web-assets, collaboration-popover, readable-time, user-selector) to match the new peerDependencies required by @box/threaded-annotations 1.89.1.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
- PopupV2 now dispatches updateAnnotationAction via ThreadedAnnotationsV2's onEdit prop when the edited id matches the root annotation. Reply edits stay no-op because the corresponding endpoint isn't exposed. - replyToTextMessage reads reply.permissions from the backend payload instead of hardcoding false/true. canEdit stays false on replies to keep the Edit menu item hidden. Reply and description canReply default to false, matching the other permission defaults. - New optional onCopyLink callback on AnnotationsOptions/BaseAnnotator threaded through a React context to PopupV2 and passed to ThreadedAnnotationsV2. When omitted, the thread UI hides the Copy link menu item.
Threaded-annotations renders Copy link on every message and passes the clicked message id. PopupV2 now wraps the consumer callback so any click forwards the root annotation id together with the file version id read from store options. Lets the consumer build a versioned deep link without any branching.
Two same-typed positional strings let consumers transpose annotationId and fileVersionId without a compile-time signal. Switching to an object arg removes the swap risk and lets future fields land additively. Also adds a test covering the path where fileVersionId is absent so the Copy link entry stays hidden.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR bumps
@box/threaded-annotationsfrom^1.86.0to^1.89.1and wires up the new capabilities the upgrade enables.Dep bump
@box/threaded-annotations:^1.86.0to^1.89.1devDependenciesandpeerDependenciesupdated to match the new peer contract:@box/blueprint-web^14.30.0,@box/blueprint-web-assets^4.117.2,@box/collaboration-popover^1.62.3,@box/readable-time^1.41.3,@box/user-selector^1.76.3.Root-message edit
PopupV2now passesonEdittoThreadedAnnotationsV2. When the edited id matches the root annotation, it dispatchesupdateAnnotationAction({ payload: { message } }). Reply edits stay no-op because the corresponding reply-edit endpoint is not exposed by the shared API client.Backend-driven reply permissions
ReplyPermissionsand optionalReply.permissions.replyToTextMessagenow readsreply.permissions.can_*from the backend instead of hardcoding all tofalse/true.canEditon replies stays forced tofalseso the Edit menu item never renders for messages that have no working save path.canReplyon both the reply and description paths defaults tofalse(matching the other permission defaults) so viewer-only users do not see Reply UI that would fail server-side.descriptionToTextMessagereads author, id, created_at, and permissions only from theAnnotation(not from the sparse description object). Root-message author and permissions belong to the annotation.onCopyLink plumbing
onCopyLink: (id: string) => voidonAnnotationsOptionsandBaseAnnotator.Options.manager.render({ callbacks }), forwarded byPopupManager, delivered via a newAnnotationCallbacksContextinsidewithProviders, and consumed inPopupV2withReact.useContext.box-content-previewandEndUserAppis required to actually surface the option to end consumers; until then this is wiring-only and safe to ship.Test coverage
onEditdispatch branch, the reply-edit no-op, andonCopyLinkforwarding from context.callbacksarg shape.onCopyLinkfield.Test plan
yarn test --watchAll=false(958 tests pass)yarn lint:ts(type check + lint clean)onCopyLinkis not supplied (follow-up consumer PRs required to exercise the positive path)