veda-consulting-company / uk.co.vedaconsulting.mosaico

Other
39 stars 75 forks source link

Storage for individual Mosaico mailings #72

Closed totten closed 7 years ago

totten commented 7 years ago

If you consider both traditional content (body_html) and newer Mosaico-based content (metadata + content + rendered HTML), and consider both the use-cases of templates and individual mailings, then we have four scenarios for storing things in the database:

  1. Traditional-style templates (e.g. civicrm_msg_template records with body_html)
  2. Traditional-style mailings (e.g. civicrm_mailing records with body_html)
  3. Mosaico-style templates (e.g. civicrm_mosaico_msg_template with template, metadata, html plus civicrm_msg_template)
  4. Mosaico-style mailings

There's currently no data-storage for saving a Mosaico-style mailing in its canonical/pristine form (without additional records in civicrm_msg_template and civicrm_mosaico_msg_template and synchronization logic). As we simplify the workflows for Mosaico, we need some way to pristinely store a Mosaico-style mailing.

I'm intending to work on this next week but wanted to verbalize some approaches first (partially for my own clarity - but also in case @deepak-srivastava or other folks see additional issues). The approaches are:

Personal preference is to define core columns because it addresses

(Tangential Observation: None of those options above discuss the hash_key. That field is part of Mosaico's localStorage adapter, but they have recommendations which allow you to ignore the localStorage and hash_key stuff when you have your own storage mechanism. See also: https://github.com/voidlabs/mosaico/issues/73#issuecomment-198584809 IMHO, keeping the localStorage/hash_key makes it hard to think about the dataflow because client-state and server-state may not match.)

deepak-srivastava commented 7 years ago

I would prefer core columns approach as well - also provides room for other possible template builders in future e.g - https://beefree.io/ (template_type = 'beefree').

With the core support would it be better to have code structured in a way that it also allows other possible template builders to inject / take control? Need not be perfect at this point, but can evolve as new template builders appear / integrated? And in doing so it could also template builders to use their own tables if needed?

And totally agree on the idea of getting rid of hash_key and local storage.

totten commented 7 years ago

Yes, we'll need a way for the alternative template builders to inject themselves. Generally, expect two touch-points:

Will report back when I have more details.

totten commented 7 years ago

See also: https://issues.civicrm.org/jira/browse/CRM-19690

totten commented 7 years ago

It was good to have some discussion/evaluation here, but -- based on the chosen design -- the locus of attention on this shifted to CRM-19690, so I think we can close this.