Skip to content

Commit

Permalink
Removing validations not valid for content fields (#2486)
Browse files Browse the repository at this point in the history
* Removing validations not valid for content fields

* update comments

* Update @microsoft-teams-js-a1bf0d67-6f27-4b52-bcbb-30f734313db1.json

* Update change/@microsoft-teams-js-a1bf0d67-6f27-4b52-bcbb-30f734313db1.json

---------

Co-authored-by: AE ( ͡ಠ ʖ̯ ͡ಠ) <[email protected]>
Co-authored-by: Trevor Harris <[email protected]>
  • Loading branch information
3 people authored Aug 29, 2024
1 parent cf2e722 commit d007a31
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Removed invalid validations for content fields on `IContentResponse` interface",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
10 changes: 3 additions & 7 deletions packages/teams-js/src/public/sharing.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sendAndHandleSdkError } from '../internal/communication';
import { ensureInitialized } from '../internal/internalAPIs';
import { ApiName, ApiVersionNumber, getApiVersionTag } from '../internal/telemetry';
import { callCallbackWithSdkErrorFromPromiseAndReturnPromise, InputFunction, validateUuid } from '../internal/utils';
import { callCallbackWithSdkErrorFromPromiseAndReturnPromise, InputFunction } from '../internal/utils';
import { errorNotSupportedOnPlatform, FrameContexts } from './constants';
import { ErrorCode, SdkError } from './interfaces';
import { runtime } from './runtime';
Expand Down Expand Up @@ -213,9 +213,9 @@ export namespace sharing {
title: string;
/** Reference of the shared content */
contentReference: string;
/** Id of the thread where the content was shared. This is a UUID */
/** Id of the thread where the content was shared. */
threadId: string;
/** Id of the user who shared the content. This is a UUID */
/** Id of the user who shared the content. */
author: string;
/** Type of the shared content.
* For sharing to Teams stage scenarios, this value would be `ShareToStage`
Expand Down Expand Up @@ -243,10 +243,6 @@ export namespace sharing {
getApiVersionTag(sharingTelemetryVersionNumber_v2, ApiName.Sharing_History_GetContent),
'sharing.history.getContent',
);
contentDetails.map((contentDetails) => {
validateUuid(contentDetails.author);
validateUuid(contentDetails.threadId);
});

return contentDetails;
}
Expand Down
44 changes: 0 additions & 44 deletions packages/teams-js/test/public/sharing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,50 +758,6 @@ describe('sharing_v2', () => {
} as DOMMessageEvent);
expect(promise).rejects.toEqual({ errorCode: ErrorCode.INTERNAL_ERROR });
});

it(`sharing.history.getContent should throw if author id is invalid uuid. context: ${context}`, async () => {
await utils.initializeWithContext(context);
utils.setRuntimeConfig({ apiVersion: 1, supports: { sharing: { history: {} } } });
const promise = sharing.history.getContent();
const contentDetails = [
{
appId: 'appId',
title: 'title',
contentReference: 'contentReference',
threadId: 'fe4a8eba-2a31-4737-8e33-e5fae6fee194',
author: 'authorId',
contentType: 'contentType',
},
];
await utils.respondToFramelessMessage({
data: {
args: [null, contentDetails],
},
} as DOMMessageEvent);
expect(promise).rejects.toEqual({ errorCode: ErrorCode.INTERNAL_ERROR });
});

it(`sharing.history.getContent should throw if threadId is invalid uuid. context: ${context}`, async () => {
await utils.initializeWithContext(context);
utils.setRuntimeConfig({ apiVersion: 1, supports: { sharing: { history: {} } } });
const promise = sharing.history.getContent();
const contentDetails = [
{
appId: 'appId',
title: 'title',
contentReference: 'contentReference',
threadId: 'threadId',
author: 'da5b7aeb-2a31-6151-5e51-d4eab4abe577',
contentType: 'contentType',
},
];
await utils.respondToFramelessMessage({
data: {
args: [null, contentDetails],
},
} as DOMMessageEvent);
expect(promise).rejects.toEqual({ errorCode: ErrorCode.INTERNAL_ERROR });
});
} else {
it(`should not allow sharing.history.getContent calls from ${context} context`, async () => {
await utils.initializeWithContext(context);
Expand Down

0 comments on commit d007a31

Please sign in to comment.