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

Use Order#email to show the order's email in new admin #5596

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

softr8
Copy link
Contributor

@softr8 softr8 commented Jan 15, 2024

Summary

spree_orders table has the column email which stores the email of
guest orders or users email for non guest orders. We should use
that in the new admin to display the email so that guest orders work
as well.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@softr8 softr8 requested a review from a team as a code owner January 15, 2024 19:19
@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_admin labels Jan 15, 2024
@softr8 softr8 force-pushed the backend_order_email branch from 3fc8a15 to deed35a Compare January 15, 2024 22:32
Copy link

codecov bot commented Jan 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.58%. Comparing base (be710f3) to head (deed35a).
Report is 1121 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5596   +/-   ##
=======================================
  Coverage   88.58%   88.58%           
=======================================
  Files         685      685           
  Lines       16404    16406    +2     
=======================================
+ Hits        14531    14533    +2     
  Misses       1873     1873           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jarednorman
Copy link
Member

I'm not necessarily opposed to this change, but can you provide some more context? In all the stores I work on, the order email gets set to the user email for non-guest orders, so I'm not sure how much value this provides.

@softr8
Copy link
Contributor Author

softr8 commented Jan 16, 2024

I'm not necessarily opposed to this change, but can you provide some more context? In all the stores I work on, the order email gets set to the user email for non-guest orders, so I'm not sure how much value this provides.

I have some apps that behave like PoS, where a logged-in user can create orders for others, this is just the view layer, it does not change anything at all, The previous admin used to render order.email instead of order.user&.email || order.email

@jarednorman
Copy link
Member

How does users creating orders for others factor in? Shouldn't that use the created_by field?

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

This is actually a bug fix, but I think we should just use order.email here, as this already takes your use case into account.

core/app/models/spree/order.rb Outdated Show resolved Hide resolved
@tvdeyen tvdeyen added type:bug Error, flaw or fault backport-v4.4 Backport this pull-request to v4.4 labels Nov 15, 2024
@tvdeyen tvdeyen force-pushed the backend_order_email branch from deed35a to 9364b2c Compare December 3, 2024 15:13
@github-actions github-actions bot removed the changelog:solidus_core Changes to the solidus_core gem label Dec 3, 2024
@tvdeyen
Copy link
Member

tvdeyen commented Dec 3, 2024

@softr8 I made the change so that we can merge this in. Thanks for reporting.

@tvdeyen tvdeyen changed the title Adds Order#order_email to show the order's email Use Order#email to show the order's email in new admin Dec 3, 2024
@tvdeyen tvdeyen added backport-v4.2 Backport this pull-request to v4.2 backport-v4.3 Backport this pull-request to v4.3 labels Dec 3, 2024
`spree_orders` table has the column `email` which stores the email of
guest orders or users email for non guest orders. We should use
that in the new admin to display the email so that guest orders work
as well.
@tvdeyen tvdeyen force-pushed the backend_order_email branch from 9364b2c to 93abf41 Compare December 3, 2024 16:47
@tvdeyen tvdeyen merged commit 4e7fe98 into solidusio:main Dec 4, 2024
13 of 14 checks passed
Copy link

github-actions bot commented Dec 4, 2024

@tvdeyen
Copy link
Member

tvdeyen commented Dec 4, 2024

💚 All backports created successfully

Status Branch Result
v4.3

Questions ?

Please refer to the Backport tool documentation

@tvdeyen
Copy link
Member

tvdeyen commented Dec 4, 2024

💚 All backports created successfully

Status Branch Result
v4.2

Questions ?

Please refer to the Backport tool documentation

@softr8
Copy link
Contributor Author

softr8 commented Dec 4, 2024

Thanks @tvdeyen !!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v4.2 Backport this pull-request to v4.2 backport-v4.3 Backport this pull-request to v4.3 backport-v4.4 Backport this pull-request to v4.4 changelog:solidus_admin type:bug Error, flaw or fault
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants