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

dev/core#2814 Fix activity:sendEmail to use renderTemplate #21365

Merged
merged 1 commit into from
Sep 6, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

dev/core#2814 Fix activity:sendEmail to use renderTemplate

Before

ReplaceContactTokens called

After

renderTemplate called

Technical Details

There is good test cover on this. I added an extra test for the scenario where smarty is enabled in this context. All other changes in the relevant tests are tidy ups & don't materially change them.

Note that this does create a situation where more queries could occur but

  1. this is only called in core from the email task - which is limited to 50 contacts so it
    is low-volume

  2. this is really the start of a cleanup - there are other places where
    queries can be removed when we look at the total flow but I feel we need to get
    some simplification happening first & once we are doing things in a more consistent way I will be better placed to rationalise the queries

  3. this seems to be called in extensions to some extent - and it should still work

  • there might be more queries but I think the 'support contract' for calling an
    unsupported function does not include it working in ways not required by
    core code

Comments

@civibot
Copy link

civibot bot commented Sep 3, 2021

(Standard links)

],
'{contact.first_name} {$contact.first_name}',
'{contact.first_name} {$contact.first_name}',
'{contact.first_name} {$contact.first_name}',
Copy link
Contributor

Choose a reason for hiding this comment

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

phpcs doesn't catch these indents I guess. Also down on line 1732.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not like phpcs - to be forgiving - fixed

Note that this does create a situation where more queries could occur but
1) this is only called in core from the email task - which is limited to 50 contacts so it
is low-volume
2) this is really the start of a cleanup - there are other places where
queries can be removed when we look at the total flow but I feel we need to get
some simplification happening first & hence have picked on this focus
as the first step (ie removing the calls to replaceContactTokens)
3) this seems to be called in extensions to some extent - and it should still work
- there might be more queries but I think the 'support contract' for calling an
unsupported function does not include it working in ways not required by
core code
@colemanw
Copy link
Member

colemanw commented Sep 6, 2021

I agree test cover is good, and this PR adds more tests. Refactoring makes sense.

@colemanw colemanw merged commit b8aa9d7 into civicrm:master Sep 6, 2021
@eileenmcnaughton eileenmcnaughton deleted the act_send branch September 6, 2021 01:47
@demeritcowboy
Copy link
Contributor

Emails now have the literal {contact.XXX} in them.

@eileenmcnaughton
Copy link
Contributor Author

@demeritcowboy yeah - looks like the tests focussed on the created activity & I didn't spot it wasn't passing through. Fix coming

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.

3 participants