FluidFramework icon indicating copy to clipboard operation
FluidFramework copied to clipboard

Add nav parameter to the sharing link in ODSP driver resolved url

Open MarioJGMsoft opened this issue 1 year ago • 1 comments

Fixes: AB#20323

Description

When we create a file, we receive the sharing link information from the service in the response. We then use that to set the sharingLink prop on the resolved url which is then supposed to be used by the hosts. We extract the sharing link info in this function: /**

  • If user requested creation of a sharing link along with the creation of the file by providing
  • createLinkScope in the request parameters then extract and save the sharing link information from
  • the response if it is available.
  • In case there was an error in creation of the sharing link, error is provided back in the response,
  • and does not impact the creation of file in ODSP.
  • @param requestedSharingLinkKind - Kind of sharing link requested to be created along with the creation of file.
  • @param response - Response object received from the /snapshot api call
  • @returns Sharing link information received in the response from a successful creation of a file. / function extractShareLinkData( response: ICreateFileResponse, enableSingleRequestForShareLinkWithCreate?: boolean, ): ShareLinkInfoType | undefined { let shareLinkInfo: ShareLinkInfoType | undefined; if (enableSingleRequestForShareLinkWithCreate) { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const { sharing } = response; if (!sharing) { return; } / eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access / shareLinkInfo = { createLink: { link: sharing.sharingLink ? { scope: sharing.sharingLink.scope, role: sharing.sharingLink.type, webUrl: sharing.sharingLink.webUrl, ...sharing.sharingLink, } : undefined, error: sharing.error, shareId: sharing.shareId, }, }; / eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */ } return shareLinkInfo; }

However, the hosts also needs the nav parameter as a query parameter on this link(weburl), we use appendLocatorParams, to append that query parameter, however that is in the URl resolver class. We can separate that code into a separate utility api which is called by both the appendLocatorParams in the resolver and also by the createFile.ts in the odsp driver in order to append that parameter.

appendLocatorParams

MarioJGMsoft avatar Oct 18 '24 19:10 MarioJGMsoft

@fluid-example/bundle-size-tests: +2.72 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 467.08 KB 467.11 KB +35 Bytes
azureClient.js 563.85 KB 563.97 KB +118 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 263.27 KB 263.29 KB +14 Bytes
fluidFramework.js 428.93 KB 428.94 KB +14 Bytes
loader.js 134.18 KB 134.26 KB +83 Bytes
map.js 42.71 KB 42.71 KB +7 Bytes
matrix.js 150.15 KB 150.16 KB +7 Bytes
odspClient.js 530.45 KB 531.69 KB +1.24 KB
odspDriver.js 98.65 KB 99.6 KB +977 Bytes
odspPrefetchSnapshot.js 43.04 KB 43.05 KB +14 Bytes
sharedString.js 166.23 KB 166.24 KB +7 Bytes
sharedTree.js 419.39 KB 419.39 KB +7 Bytes
Total Size 3.38 MB 3.38 MB +2.72 KB

Baseline commit: 5d813e5b68bf8633cd4b43ec366cb9754e3f9d2e

Generated by :no_entry_sign: dangerJS against 33b9df2ede5cfe8b950e6eecf4c8b9a7b5fb0f66

msfluid-bot avatar Oct 19 '24 00:10 msfluid-bot

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  170006 links
    1595 destination URLs
    1825 URLs ignored
       0 warnings
       0 errors


github-actions[bot] avatar Nov 27 '24 23:11 github-actions[bot]