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

🐛 Fixed default email recipients always being "everyone" rather than matching post visibility #16247

Merged

Conversation

kevinansfield
Copy link
Member

refs #16125

The previous fix for incorrect recipient details being shown when re-sending a failed email introduced another bug that prevented the "Match post visibility" default recipients setting from working.

  • the server always sets post.emailSegment to 'all' for new posts so the publish flow recipient filter logic that checked for post.emailSegment being present always defaulted to 'all' rather than falling back to the selected default recipients setting
  • when a post has been published but the email failed it will have its newsletter value set so we can use that as a check for using the post.emailSegment value in place of the default recipients setting

…matching post visibility

refs TryGhost#16125

The previous fix for incorrect recipient details being shown when re-sending a failed email introduced another bug that prevented the "Match post visibility" default recipients setting from working.

- the server always sets `post.emailSegment` to `'all'` for new posts so the publish flow recipient filter logic that checked for `post.emailSegment` being present always defaulted to `'all'` rather than falling back to the selected default recipients setting
- when a post has been published but the email failed it will have its `newsletter` value set so we can use that as a check for using the `post.emailSegment` value in place of the default recipients setting
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Base: 72.26% // Head: 55.95% // Decreases project coverage by -16.31% ⚠️

Coverage data is based on head (13cc1c0) compared to base (4436a1c).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #16247       +/-   ##
===========================================
- Coverage   72.26%   55.95%   -16.31%     
===========================================
  Files        1747     1672       -75     
  Lines      111392   105336     -6056     
  Branches    16812    12214     -4598     
===========================================
- Hits        80502    58946    -21556     
- Misses      29582    45081    +15499     
- Partials     1308     1309        +1     
Flag Coverage Δ
e2e-tests ?
unit-tests 55.95% <0.00%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
ghost/admin/app/utils/publish-options.js 76.70% <0.00%> (-0.57%) ⬇️
ghost/core/core/server/web/well-known.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/server/web/admin/index.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/server/web/members/app.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/frontend/apps/amp/index.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/server/web/members/index.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/server/web/comments/index.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/server/web/comments/routes.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/server/services/stats/index.js 0.00% <0.00%> (-100.00%) ⬇️
ghost/core/core/server/services/oembed/index.js 0.00% <0.00%> (-100.00%) ⬇️
... and 472 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kevinansfield kevinansfield merged commit 923a9a1 into TryGhost:main Feb 8, 2023
@kevinansfield kevinansfield deleted the fix-default-email-recipients branch February 8, 2023 11:41
daniellockyer pushed a commit that referenced this pull request Feb 9, 2023
…matching post visibility (#16247)

refs #16125

The previous fix for incorrect recipient details being shown when
re-sending a failed email introduced another bug that prevented the
"Match post visibility" default recipients setting from working.

- the server always sets `post.emailSegment` to `'all'` for new posts so
the publish flow recipient filter logic that checked for
`post.emailSegment` being present always defaulted to `'all'` rather
than falling back to the selected default recipients setting
- when a post has been published but the email failed it will have its
`newsletter` value set so we can use that as a check for using the
`post.emailSegment` value in place of the default recipients setting
@flavianh
Copy link

flavianh commented Feb 9, 2023

Aren't there any tests in Ghost that could prevent such regressions from happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants