Closed (fixed)
Project:
Mail Editor
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Jul 2015 at 22:53 UTC
Updated:
31 Aug 2021 at 13:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Miguel.kode commentedI am working on it.
This is the repository:
https://github.com/MiguelCarogar/mail_edit_d8
Comment #2
salvisThanks for jumping in, Miguel.kode!
Please be aware of Mail Editor's "special relationship" with Subscriptions. ME is useful in its own right, but it's also open for extensive customization by modules like Subscriptions, and this capability needs to be carried over into D8.
Comment #3
Miguel.kode commentedOk salvis. I will work on it. Thanks
Comment #4
salvisHave you been able to make any progress, Miguel.kode?
Comment #5
damienmckennaComment #6
damienmckennaThere's an 8.x-1.x branch, but it only includes a copy of 7.x-1.x's codebase.
Given D8's mail system is almost identical to D7's, this should be a pretty straightforward port.
Comment #7
salvisComment #8
damienmckennafyi I'm actively working on this, hope to have a prototype on Thursday.
Comment #9
salvisFantastic, welcome!
Comment #10
damienmckennaThis is v0.1 - it can edit system emails but nothing else. Tomorrow I'll be working on making it able to edit custom emails.
Comment #11
damienmckennaAlso, no tests yet.
Comment #12
damienmckennaFYI I didn't go into any language handling at all because I think we should push to support core's config translation system and just leave this module as a unified system for modifying all emails. That said, I could be completely wrong on this assumption as I haven't dug into how core's config translation system works.
Comment #13
damienmckennaSome serious refactoring, and addition of some hooks to allow this to be extendable.
My next step is to test out adding hooks to my own module to confirm it all works as intended.
Comment #14
damienmckennaThis fixes some problems with the previous version, and now allows emails to be dynamically generated, i.e. the config objects don't have to exist before someone edits them, so long as they're defined in the appropriate hooks it'll be possible to save something.
Comment #15
damienmckennaThe patch in #14 is working for me, would love to hear what could be done to improve upon it.
Comment #16
damienmckennaThis includes improvements to the comments.
Comment #17
damienmckennaSome more minor coding format tweaks.
Comment #18
damienmckennaThere was a typo in MailEditTemplateForm.php, sorry.
Comment #19
salvisI'm sorry, I'm on the road with little connectivity until the end of next week. I'll try to take a look ASAP before that, but I can't promise.
Thank you very much for working on it!
Comment #20
damienmckenna@salvis: No problem :)
FYI I was short on time so built the APIs in D7-style hooks, this may be enough for a quick 1.0 release, but it probably would be worth putting the time into building a proper annotation-based API.
Comment #21
salvisI found out that I've already branched 8.x-1.x from 7.x-1.x, but the latter got a few more commits, and I've committed #2735109: Some spaces disappear from long mail subjects (at least when using Mimemail). Now, I'm waiting for the testbot to complete. Then I'll tag 7.x-1.2, merge the missing commits to 8.x-1.x.
#18 doesn't apply to yesterday's 8.x-1.x—I assume you've diffed it against 7.x-1.x—but I'll just copy over the zip file and adjust the change log. There's nothing you need to do.
The testbot hasn't budged yet, I'll continue tomorrow.
Do you by any chance know whether the bug mentioned in #2735109: Some spaces disappear from long mail subjects (at least when using Mimemail) is also in your D8 port?
Comment #22
damienmckennaThe port I created was a from-scratch rewrite that does not use any custom data structures, instead it relies on hooks and existing config entities for the emails; one rationale for this is that it pushes the translation handling to core's config translation system rather than having to manually handle it, though I haven't tested it. That said, I did keep the same permission and menu path ;-)
Comment #23
salvisThank you, that's a good start.
Here are some changes that I've made, and some comments:
I prefer to keep the change log across major versions.
This needs to be 'help.page.mail_edit'.
I've added a dummy test so that I can enable the testbot.
I'm still checking it in as a work-in-progress, so that we have a base to build on.
Do you have a contrib that uses Mail Editor?
Comment #25
salvisHmm, can I not make the snapshot release visible on the front page anymore?
Comment #26
damienmckennaI fixed the problem on the release node, there was a checkbox you had to check for the dev snapshot to make it visible.
Comment #27
damienmckennaThanks for committing the patch.
I had specifically avoided adding an extra data storage layer because I felt the system should focus on editing the original emails. That way if someone edits the message in the original location there won't be any difference in what they see.
I also have not tested the config translations. It might be worth adding an indicator on the page as to which language is being accessed.
I didn't add support to any other contrib modules (yet), it was for custom code.
Comment #28
salvisThank you for publishing the snapshot!
Yes, that makes sense for the user templates, there seems to be storage for each active language, but somehow neither Core nor Mail Editor manage to get the right slot (or even the same slot) for every operation...
However, for third party modules (like Subscriptions), that rely completely on Mail Editor, we'll need storage. Right now, Mail Editor doesn't offer much more than Core does.
Why the character count? I don't think I want to keep that...
Comment #29
damienmckennaThe idea for 3rd party modules was to leverage existing configuration objects and to just work out a (better?) API to handle them? Then we'd be defining an API for other modules to take advantage of.
The character count was just something to help tell how large the different emails were, it can be removed without any concern.
Comment #30
salvisYes, exactly. Client modules just define mailkeys and default text, and Mail Editor does the rest. It provides conditions and loops for working with tokens, and the client module can provide additional tokens to be used in the templates.
The Subscriptions module added a second template field (for formatting comments to go with nodes) and a preview mode. Preview cannot be provided by Mail Editor alone, because the client module has to supply the data to go with the template, but Mail Editor could help.
Comment #31
alexdmccabeMarking as fixed because it has been committed.