Skip to content

Show download link and icon based on contentUrl#2868

Merged
compulim merged 10 commits intomicrosoft:masterfrom
compulim:feat-file-content
Feb 6, 2020
Merged

Show download link and icon based on contentUrl#2868
compulim merged 10 commits intomicrosoft:masterfrom
compulim:feat-file-content

Conversation

@compulim
Copy link
Copy Markdown
Contributor

@compulim compulim commented Jan 29, 2020

Fixes #2864.

Changelog Entry

Fixed

  • Fixes #2864. Replaced DownloadAttachment and UploadAttachment with FileAttachment, which show download link and icon if the attachment contains contentUrl, by @compulim in PR #XXX

Description

Today, we assume the channel do not allow end-user to download the file they uploaded. This assumption is not valid for channels other than Direct Line.

We should use activity.attachments[].contentUrl to determine whether the file can be downloaded or not.

Specific Changes

  • For incoming activities, if the attachment should not be downloaded, empty out contentUrl
    • If the URL is pointing to Direct Line dummy placeholder, it should not be downloadable
    • If the URL protocol is blob:, it should not be downloadable
  • Replace <DownloadAttachment> and <UploadAttachment> with <FileAttachment>, which will determine if the download link and icon should be shown or not, based on contentUrl is truthy or not
  • Expose <FileContent> similar to other components, e.g. <AudioContent>, <TextContent>, <VideoContent>, etc

  • Testing Added

@compulim compulim changed the title Show download link and icon based on contentUrl [DRAFT] Show download link and icon based on contentUrl Jan 29, 2020
@compulim compulim marked this pull request as ready for review January 30, 2020 03:16
@compulim compulim changed the title [DRAFT] Show download link and icon based on contentUrl Show download link and icon based on contentUrl Jan 30, 2020
Comment thread CHANGELOG.md Outdated
Comment thread packages/component/src/Attachment/FileContent.js
Comment thread packages/component/src/Styles/StyleSet/FileAttachment.js Outdated
@compulim
Copy link
Copy Markdown
Contributor Author

compulim commented Feb 6, 2020

Thanks @tdurnford for reviewing this PR.

@compulim compulim merged commit 17f4069 into microsoft:master Feb 6, 2020
@compulim compulim deleted the feat-file-content branch February 6, 2020 10:48
@compulim compulim mentioned this pull request Mar 5, 2020
40 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IC3] Activity.attachments[].contentUrl should be used for allowing download attachments or not

2 participants