-
Notifications
You must be signed in to change notification settings - Fork 78
[Chat] Remove AttachmentMetadata #4217
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
Changes from 30 commits
09468e6
da03ff4
dc9fbf8
dbb2efb
676b7d6
6922e00
1dd3191
0f25341
f11bfcb
d3bc3d3
dca8589
45d9ac2
c5c9550
63f24f3
1830c0b
743c04f
c405456
ee2bcb3
8ccf5cd
c964209
06fc3e6
cd704c8
4ab91fc
390f3c7
5fc6fde
2645032
7cee6c5
2a37e99
7fdef4b
6cd8379
b21a3f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "type": "minor", | ||
| "area": "improvement", | ||
| "workstream": "InlineImage", | ||
| "comment": "Remove AttachmentMetadata", | ||
| "packageName": "@azure/communication-react", | ||
| "email": "107075081+Leah-Xia-Microsoft@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "type": "minor", | ||
| "area": "improvement", | ||
| "workstream": "InlineImage", | ||
| "comment": "Remove AttachmentMetadata", | ||
| "packageName": "@azure/communication-react", | ||
| "email": "107075081+Leah-Xia-Microsoft@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,11 @@ export type AnnouncerProps = { | |
| }; | ||
|
|
||
| // @beta | ||
| export type AttachmentMetadata = FileMetadata; | ||
| export interface AttachmentMetadata { | ||
| extension: string; | ||
| name: string; | ||
| url: string; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes id and payload is under the feature flag while the rest somehow was released to GA.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually this is the react components api view not the react communication one. |
||
| } | ||
|
|
||
| // @public | ||
| export interface BaseCustomStyles { | ||
|
|
@@ -970,13 +974,6 @@ export interface FileDownloadError { | |
| // @beta | ||
| export type FileDownloadHandler = (userId: string, fileMetadata: AttachmentMetadata) => Promise<URL | FileDownloadError>; | ||
|
|
||
| // @beta | ||
| export interface FileMetadata { | ||
| extension: string; | ||
| name: string; | ||
| url: string; | ||
| } | ||
|
|
||
| // @internal | ||
| export interface _FileUploadCardsStrings { | ||
| removeFile: string; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,9 +26,7 @@ export type ChatAttachmentType = | |
| * | ||
| * @beta | ||
| */ | ||
| export interface FileMetadata { | ||
| /* @conditional-compile-remove(file-sharing) */ | ||
| attachmentType: 'file'; | ||
| export interface AttachmentMetadata { | ||
| /** | ||
| * Extension hint, useful for rendering a specific icon. | ||
| * An unknown or empty extension will be rendered as a generic icon. | ||
|
|
@@ -55,12 +53,6 @@ export interface FileMetadata { | |
| payload?: Record<string, string>; | ||
| } | ||
|
|
||
| /** | ||
| * Metadata containing information about the uploaded file. | ||
| * @beta | ||
| */ | ||
| export type AttachmentMetadata = FileMetadata; | ||
|
|
||
| /** | ||
| * Strings of _FileDownloadCards that can be overridden. | ||
| * | ||
|
|
@@ -166,16 +158,10 @@ export const _FileDownloadCards = (props: _FileDownloadCardsProps): JSX.Element | |
| [props.strings?.downloadFile, localeStrings.downloadFile] | ||
| ); | ||
|
|
||
| const isFileSharingAttachment = useCallback((attachment: AttachmentMetadata): boolean => { | ||
| /* @conditional-compile-remove(file-sharing) */ | ||
| return attachment.attachmentType === 'file'; | ||
| return false; | ||
| }, []); | ||
|
|
||
| /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ | ||
| const isShowDownloadIcon = useCallback((attachment: AttachmentMetadata): boolean => { | ||
| /* @conditional-compile-remove(file-sharing) */ | ||
| return attachment.attachmentType === 'file' && attachment.payload?.teamsFileAttachment !== 'true'; | ||
| return attachment.payload?.teamsFileAttachment !== 'true'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are teamsFileAttachments? |
||
| return true; | ||
| }, []); | ||
|
|
||
|
|
@@ -184,13 +170,13 @@ export const _FileDownloadCards = (props: _FileDownloadCardsProps): JSX.Element | |
| const fileGroupLocaleString = props.strings?.fileCardGroupMessage ?? localeStrings.fileCardGroupMessage; | ||
| /* @conditional-compile-remove(file-sharing) */ | ||
| return _formatString(fileGroupLocaleString, { | ||
| fileCount: `${fileMetadata?.filter(isFileSharingAttachment).length ?? 0}` | ||
| fileCount: `${fileMetadata?.length ?? 0}` | ||
| }); | ||
| return _formatString(fileGroupLocaleString, { | ||
| fileCount: `${fileMetadata?.length ?? 0}` | ||
| }); | ||
| }, | ||
| [props.strings?.fileCardGroupMessage, localeStrings.fileCardGroupMessage, fileMetadata, isFileSharingAttachment] | ||
| [props.strings?.fileCardGroupMessage, localeStrings.fileCardGroupMessage, fileMetadata] | ||
| ); | ||
|
|
||
| const fileDownloadHandler = useCallback( | ||
|
|
@@ -217,7 +203,7 @@ export const _FileDownloadCards = (props: _FileDownloadCardsProps): JSX.Element | |
| if ( | ||
| !fileMetadata || | ||
| fileMetadata.length === 0 || | ||
| /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ !fileMetadata.some(isFileSharingAttachment) | ||
| /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ !fileMetadata | ||
| ) { | ||
| return <></>; | ||
| } | ||
|
|
@@ -226,35 +212,26 @@ export const _FileDownloadCards = (props: _FileDownloadCardsProps): JSX.Element | |
| <div style={fileDownloadCardsStyle} data-ui-id="file-download-card-group"> | ||
| <_FileCardGroup ariaLabel={fileCardGroupDescription()}> | ||
| {fileMetadata && | ||
| fileMetadata | ||
| .filter((attachment) => { | ||
| /* @conditional-compile-remove(file-sharing) */ | ||
| return isFileSharingAttachment(attachment); | ||
| return true; | ||
| }) | ||
| .map((file) => file as unknown as FileMetadata) | ||
| .map((file) => ( | ||
| <TooltipHost content={downloadFileButtonString()} key={file.name}> | ||
| <_FileCard | ||
| fileName={file.name} | ||
| key={file.name} | ||
| fileExtension={file.extension} | ||
| actionIcon={ | ||
| showSpinner ? ( | ||
| <Spinner size={SpinnerSize.medium} aria-live={'polite'} role={'status'} /> | ||
| ) : true && | ||
| /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ isShowDownloadIcon( | ||
| file as unknown as AttachmentMetadata | ||
| ) ? ( | ||
| <IconButton className={iconButtonClassName} ariaLabel={downloadFileButtonString()}> | ||
| <DownloadIconTrampoline /> | ||
| </IconButton> | ||
| ) : undefined | ||
| } | ||
| actionHandler={() => fileDownloadHandler(userId, file as unknown as AttachmentMetadata)} | ||
| /> | ||
| </TooltipHost> | ||
| ))} | ||
| fileMetadata.map((file) => ( | ||
| <TooltipHost content={downloadFileButtonString()} key={file.name}> | ||
| <_FileCard | ||
| fileName={file.name} | ||
| key={file.name} | ||
| fileExtension={file.extension} | ||
| actionIcon={ | ||
| showSpinner ? ( | ||
| <Spinner size={SpinnerSize.medium} aria-live={'polite'} role={'status'} /> | ||
| ) : true && | ||
| /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ isShowDownloadIcon(file) ? ( | ||
| <IconButton className={iconButtonClassName} ariaLabel={downloadFileButtonString()}> | ||
| <DownloadIconTrampoline /> | ||
| </IconButton> | ||
| ) : undefined | ||
| } | ||
| actionHandler={() => fileDownloadHandler(userId, file)} | ||
| /> | ||
| </TooltipHost> | ||
| ))} | ||
| </_FileCardGroup> | ||
| </div> | ||
| ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.