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

Fix error with polymorphic relations when the attribute name is different to related #9396

Merged
merged 1 commit into from
Mar 11, 2021

Conversation

germangonzo
Copy link
Contributor

@germangonzo germangonzo commented Feb 14, 2021

What does it do?

Use the polymorphic attribute info to name the type field correctly.

Currently, It is hardcoded to related_type

Why is it needed?

Fix error with polymorphic relations when the attribute name is different to related

Related issue(s)/PR(s)

Look at the last comment of the issue
#5348

@strapi-cla
Copy link

strapi-cla commented Feb 14, 2021

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Feb 14, 2021

Codecov Report

Merging #9396 (c0e147e) into master (afaf111) will increase coverage by 0.04%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9396      +/-   ##
==========================================
+ Coverage   35.07%   35.12%   +0.04%     
==========================================
  Files        1308     1310       +2     
  Lines       14465    14535      +70     
  Branches     1439     1453      +14     
==========================================
+ Hits         5074     5105      +31     
- Misses       8481     8514      +33     
- Partials      910      916       +6     
Flag Coverage Δ
front 26.65% <0.00%> (ø)
unit 54.71% <75.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...strapi-admin/admin/src/containers/Admin/Wrapper.js 66.66% <ø> (ø)
...anager/admin/src/components/SelectWrapper/index.js 0.00% <ø> (ø)
...ssions/admin/src/components/Policies/Components.js 0.00% <0.00%> (ø)
...permissions/admin/src/components/Policies/index.js 0.00% <0.00%> (ø)
packages/strapi-utils/lib/sanitize-entity.js 97.10% <71.42%> (-2.90%) ⬇️
packages/strapi/lib/middlewares/session/index.js 39.28% <100.00%> (ø)
...rapi/lib/core/app-configuration/config-provider.js 70.00% <0.00%> (ø)

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 1b5da26...c0e147e. Read the comment docs.

@germangonzo germangonzo changed the title Fix error with polymorphic relations when the attribute name is diffe… Fix error with polymorphic relations when the attribute name is different to related Feb 14, 2021
Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this fix 💯
A few notes

  • We need to make sure the behaviour is the same on mongo before merging
  • To avoid unintended issues can you add a e2e test with a polymorphic model using this fix ?

@alexandrebodin alexandrebodin added source: core:database Source is core/database package issue: bug Issue reporting a bug labels Feb 15, 2021
@germangonzo
Copy link
Contributor Author

germangonzo commented Feb 15, 2021 via email

@alexandrebodin
Copy link
Member

Hi @germangonzo did you have time to work on the changes ?

@germangonzo
Copy link
Contributor Author

germangonzo commented Mar 9, 2021

Hi @germangonzo did you have time to work on the changes ?

Unfortunately, no. I've been pretty busy these weeks

@alexandrebodin alexandrebodin added this to the 3.5.3 milestone Mar 11, 2021
@alexandrebodin alexandrebodin merged commit a40e3b0 into strapi:master Mar 11, 2021
This was referenced Mar 12, 2021
This was referenced Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug source: core:database Source is core/database package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants