winter icon indicating copy to clipboard operation
winter copied to clipboard

Add mail template/layout/partial clear command

Open RomainMazB opened this issue 3 years ago • 2 comments

Package targeted

Winter CMS

Description

As of today, when modifying a mail template, layout or partial from the backend settings, the views are saved in the database, and there is no easy way to clean up these views. ~~AFAIK we need to manually erase the corresponding table entries to retrieve the default registered view.~~

Edit for this sentence 👆🏻: this could be achieved using the trash icon from the backend template update page. Thanks to mjauvin that pointed this out on Discord

Many users doesn't even know that fact and think that using the view:clear or cache:clear commands will clear the cached mail view files.

I suggest to add a console command to do the trick, mail:clear:

  • without any arguments, it would wipes all the three system_mail_* tables
  • with the --type=[template|layout|partial] argument, it would wipes only the corresponding system_mail_* table
  • with the --code argument which could handle wildcard like --code=winter.system::* or winter.user::*, it would wipes only the corresponding entries from the tables
  • type and code arguments could be used together to target only the template of a plugin as an example

The command would add a warning message to make sure no accidental data loss is permitted like:

Your are about to clear all the `winter.system::*` saved mail templates modification from the database, confirm [y/n]:

Will this change be backwards-compatible?

No response

RomainMazB avatar Jul 16 '22 08:07 RomainMazB

What I would prefer is removing the reliance on the DB tables entirely, which we may be able to do now with the new ArraySource trait in Storm, and then making it so that only once a modification has been made to the defaults provided then that is when a value is stored in the database and it becomes the new version loaded when the system is asked for that particular mail template object. @bennothommo @jaxwilko @mjauvin any thoughts?

LukeTowers avatar Jul 17 '22 19:07 LukeTowers

I thought that's how it was already.

mjauvin avatar Jul 17 '22 20:07 mjauvin

This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar Jan 16 '23 00:01 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar Jul 18 '23 00:07 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar Jan 17 '24 00:01 github-actions[bot]

Archiving for now, anyone who runs into this in the future feel free to comment and we can reopen it then.

LukeTowers avatar Feb 20 '24 17:02 LukeTowers