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 global date format for CFP end date in submission email #1185

Merged
merged 2 commits into from Nov 6, 2018

Conversation

iansltx
Copy link
Contributor

@iansltx iansltx commented Oct 12, 2018

Everything else uses the global date format, so it looks like this is a bit of an omission as it stands.

@localheinz localheinz self-requested a review October 13, 2018 08:47
@localheinz localheinz self-assigned this Oct 13, 2018
@localheinz localheinz added the bug label Oct 13, 2018
Copy link
Contributor

@localheinz localheinz left a comment

Choose a reason for hiding this comment

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

I agree with the intention of this PR, but I believe the format of dates is a presentation concern, so rather than injecting date formats into controllers or services, I would prefer it if the formatting generally occurred in the presentation layer.

What do you think, @chartjes?

@localheinz
Copy link
Contributor

@chartjes @iansltx

I have labeled this as a bug as I believe that an inconsistency in formatting dates is in fact a bug from the user’s perspective.

@iansltx
Copy link
Contributor Author

iansltx commented Oct 13, 2018

The reason I injected it at the controller level is I wasn't sure that Twig was able to access the date format string in that particular context. I'll check again shortly.

@iansltx
Copy link
Contributor Author

iansltx commented Oct 13, 2018

Looks like that date is globally injected, so I'm going to completely re-roll this.

@iansltx
Copy link
Contributor Author

iansltx commented Oct 13, 2018

False alarm; the "site" variables don't appear to exist in the Twig instance that's being used by the emails for some reason, so it's falling back to the Twig-declared date format. Tracking this down further now.

@iansltx
Copy link
Contributor Author

iansltx commented Oct 13, 2018

Okay; the issue here is that we're using an internal Twig method to render each block, rather than rendering the entire template at once, for the email. There are a few easier solutions than what I'm about to attempt:

  1. Split the email into text and HTML components
  2. Manually inject the date format, as I was doing before
  3. Manually inject site globals, somewhat similarly to what I was doing before

What I'm going to try is to have a patched Twig_Environment that allows for rendering a block with the global context added in. Wish me luck.

All of these calls are in email templates, including the talk submission
ones, but now anything that's available when rendering an entire
template is now available when rendering a block, as long as you call
renderBlockWithContext().
@iansltx
Copy link
Contributor Author

iansltx commented Oct 13, 2018

Quite a bit more work involved in the above, but in return emails can now include global Twig vars in their blocks without explicitly passing things in, and those vars will actually be there (since emails are rendered one block at a time). I've confirmed that this works exactly as expected on our instance (the correct date format is respected).

@localheinz
Copy link
Contributor

@iansltx

Don't worry too much, we can still follow up on this! 👍

@iansltx
Copy link
Contributor Author

iansltx commented Oct 22, 2018

@localheinz This now passes CI due to my fix of a flakey test elsewhere. What else do I need to do to get this merged?

@chartjes chartjes merged commit b06f830 into opencfp:master Nov 6, 2018
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.

None yet

3 participants