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

[REF] Remove illusion of looping #21554

Merged
merged 1 commit into from
Sep 22, 2021
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Sep 20, 2021

Overview

[REF] Remove illusion of looping

This foreach actually only copes with 1 value. Making that clearer makes it more readable

Before

It loops through the attachments if any but only uses the 'last one'

After

It explicitly only grabs the first one

Technical Details

If the data model only copes with 1 then I don't think first vs last is material - the reality is it works with up to 1 attachment & clarifying that now means we don't have to later....

Most of this handling seems to be because it could be NULL rather than an array

This functionality appears to be about allowing an attachment to be the message template - ie upload a doc as a template rather than save a message template - so more than 1 file makes no sense

Comments

This foreach actually only copes with 1 values. Making that clearer makes it more readable
@civibot
Copy link

civibot bot commented Sep 20, 2021

(Standard links)

@civibot civibot bot added the master label Sep 20, 2021
@demeritcowboy demeritcowboy merged commit 07f3305 into civicrm:master Sep 22, 2021
@eileenmcnaughton eileenmcnaughton deleted the loop branch September 22, 2021 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants