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
[CIS-2262] Allow changing attachment info with custom CDN #2369
[CIS-2262] Allow changing attachment info with custom CDN #2369
Conversation
Generated by 🚫 Danger |
1c4d1ba
to
d84d98e
Compare
57a0ed5
to
a4590d0
Compare
📏 Size AnalysisTotal install size 10.6 MB | This change: ⬆️ +18.3 kB (+0.172%)🗂 See size breakdown
🔎 See the full size analysis (fb4e383) merging into develop (d6c94f3)
|
fb4e383
to
48219c5
Compare
0da3d14
to
fec0039
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general. I'm only worried about this line:
let previewUrl = try container.decodeIfPresent(URL.self, forKey: .thumbURL) ?? imageURL
.
It seems we were previously decoding the thumbURL and setting the previewURL after all. Now this logic is gone, which might be a breaking change.
Sources/StreamChat/Models/Attachments/AnyAttachmentUpdater.swift
Outdated
Show resolved
Hide resolved
This does not exist, our API does not return any thumb_url for Images. Also, our ImageAttachmentPayload does not encode that value, so it would never be sent to the server even if has a customer you updated the previewUrl. So this is fine to remove |
… the Queue Uploader
fec0039
to
6975ff4
Compare
8da7bb0
to
9626c96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work @nuno-vieira 👏
…fo-with-custom-cdn
…fo-with-custom-cdn
Kudos, SonarCloud Quality Gate passed! |
🔗 Issue Links
CIS-2262
🎯 Goal
Currently, our
CDNClient
protocol expects always to return a singleURL
. This is very limited since a customer might want to update the attachment info using their file uploader API, like changing the preview URL or adding extra data.The goal of this PR is to improve this and allow the customer to change the final attachment when uploading to their CDN.
🛠 Implementation
AttachmentUploader
and renames the old one toAttachmentQueueUploader
.channelController.uploadFile()
andchannelController.uploadImage()
are now deprecated in favour ofchannelController.uploadAttachment()
The
CDNClient
can be customized if you are only interested in changing the CDN Url and do not want to update the attachment payload.The
AtttachmentUploader
can be customized for more fine-grain control, in case you want to update the final attachment with additional information.🧪 Manual Testing Notes
Probably worth doing smoke testing related to loading images.
☑️ Contributor Checklist