Skip to content

Conversation

Aschen
Copy link
Contributor

@Aschen Aschen commented Apr 12, 2021

What does this PR do ?

Since the last release, the user content is accessible under the user._source property in addition to the user.content property.

A getter was added for backward compatibility but when a User object was returned in a controller action it was serialized with only the _source property, breaking existing APIs relying on the content property.

This PR fix that but the sent data will be duplicated. A safe serialize method has been added to the User, Role and Profile classes and should be used instead of returning the instances directly.

Other changes

Boyscout

@Aschen Aschen self-assigned this Apr 12, 2021
@Aschen Aschen changed the title Fix breaking on User content [HOTFIX] Ensure returning the user body in the content property when serialized Apr 12, 2021
@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

Merging #630 (c21faed) into master (8beec6a) will decrease coverage by 0.15%.
The diff coverage is 22.22%.

❗ Current head c21faed differs from pull request most recent head a8c2511. Consider uploading reports for the commit a8c2511 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #630      +/-   ##
==========================================
- Coverage   86.30%   86.15%   -0.16%     
==========================================
  Files          34       34              
  Lines        1585     1589       +4     
  Branches      279      279              
==========================================
+ Hits         1368     1369       +1     
- Misses        159      162       +3     
  Partials       58       58              
Impacted Files Coverage Δ
src/controllers/Document.ts 68.47% <0.00%> (ø)
src/core/security/Profile.ts 92.30% <0.00%> (-7.70%) ⬇️
src/core/security/Role.ts 62.50% <0.00%> (-8.93%) ⬇️
src/utils/Deprecation.ts 100.00% <ø> (ø)
src/core/security/User.ts 92.85% <66.66%> (-7.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bf128c...a8c2511. Read the comment docs.

@Aschen Aschen merged commit f1494dc into master Apr 13, 2021
@Aschen Aschen deleted the fix-breaking-on-user-content branch April 13, 2021 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants