Skip to content
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

compose - switch to media api for attachment upload #276

Merged

Conversation

susanm74
Copy link
Contributor

@susanm74 susanm74 commented Mar 3, 2023

- remove type from Attachment interface
- switch from msgmedia/upload to api/v2/media in progress

nyaruka/rapidpro#4347
- updated postFormData, for a rejected promise, to pass the string response.body if/when available, but if not, to continue to pass the string 'Server failure'
- updated the catch block to process the error json file array to display the first err msg in the array if/when available, but if not, to display the initial error string

nyaruka/rapidpro#4347
- added error handling for both django and nginx errors to  compose component
- added check for upload endpoint when rejecting a promise, and passing the full response back, while maintaining status quo and passing the 'Server failure' string back for everything else

nyaruka/rapidpro#4347
@codecov
Copy link

codecov bot commented Mar 3, 2023

Codecov Report

Merging #276 (32d7e9e) into main (4a7c04b) will decrease coverage by 0.04%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
- Coverage   79.41%   79.38%   -0.04%     
==========================================
  Files          67       67              
  Lines       17467    17476       +9     
  Branches      593      592       -1     
==========================================
+ Hits        13872    13873       +1     
- Misses       3588     3596       +8     
  Partials        7        7              
Impacted Files Coverage Δ
src/utils/index.ts 61.19% <12.50%> (-0.49%) ⬇️
src/compose/Compose.ts 79.89% <40.00%> (-0.11%) ⬇️
src/contacts/ContactHistory.ts 67.16% <0.00%> (-0.10%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@susanm74
Copy link
Contributor Author

susanm74 commented Mar 3, 2023

AFTER - happy path - successfully uploaded attachment
Screen Shot 2023-03-03 at 2 34 28 PM

AFTER - django error due to file unsupported file type
Screen Shot 2023-03-03 at 2 26 32 PM

AFTER - django error due to file exceeding max file size, but less than nginx max file size
Screen Shot 2023-03-03 at 2 27 14 PM

AFTER - nginx error due to file exceeding max file size
Screen Shot 2023-03-03 at 2 28 29 PM

src/compose/Compose.ts Outdated Show resolved Hide resolved
@susanm74 susanm74 changed the title compose component - switch to media api for attachment uploads compose - switch to media api for attachment upload Mar 8, 2023
@ericnewcomer ericnewcomer merged commit eedb858 into main Mar 8, 2023
@ericnewcomer ericnewcomer deleted the sl-compose-switch-to-media-api-for-attachment-uploads branch March 8, 2023 21:28
@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to using media.json API endpoint for attachment uploads
3 participants