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
Refactor backend mail method #2643
Conversation
Missed MailInterceptor and MailSetting specs, I pushed one more to fix them and move them to /core/specs. I believe that's where they belong. |
It would still allow admin to edit settings through admin UI. But this PR makes that happen using Spree::Config instead of saving records on a spree_mail_methods table. And since it's done through Spree::Config users can also configure this on the initializer. I can't see a reason to have a list of mail method when Spree only uses I'm aware that if this gets merged in the spree_mail_method table still needs to be dropped eventually and we'll need to update the docs. I'm willing to help with that too just in case. |
@@ -1,32 +1,6 @@ | |||
module Spree | |||
class MailMethod < ActiveRecord::Base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this class still belong in models if it's not a model? I think a better place for it would be lib/spree/core/mail_method.rb
, with the class then becoming Spree::Core::MailMethod
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I just realized I might as well just move the constants to the Spree::Core::MailSettings
class and just get rid of the MailMethod
Sounds good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, please do that.
On Thu, Mar 28, 2013 at 3:14 PM, Washington Júnior
notifications@github.com wrote:
@@ -1,32 +1,6 @@
module Spree
- class MailMethod < ActiveRecord::Base
Makes sense. I just realized I might as well just move the constants to theSpree::Core::MailSettings
class and just get rid of theMailMethod
Sounds good?
Reply to this email directly or view it on GitHub:
https://github.com/spree/spree/pull/2643/files#r3564784
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
On Thu, Mar 28, 2013 at 1:59 AM, Ryan Bigg notifications@github.com wrote:
In core/app/models/spree/mail_method.rb:
@@ -1,32 +1,6 @@
module Spree
- class MailMethod < ActiveRecord::Base
Yup, please do that.
… <#13daf5d0f4bfb1e1_>
On Thu, Mar 28, 2013 at 3:14 PM, Washington Júnior <
notifications@github.com> wrote: > @@ -1,32 +1,6 @@ > module Spree > -
class MailMethod < ActiveRecord::Base Makes sense. I just realized I might
as well just move the constants to theSpree::Core::MailSettings
class
and just get rid of theMailMethod
Sounds good? --- Reply to this email
directly or view it on GitHub:
https://github.com/spree/spree/pull/2643/files#r3564784—
Reply to this email directly or view it on GitHubhttps://github.com//pull/2643/files#r3565037
.
Washington Luiz B Jr
web developer
Alright, I've looked over this again. It looks like a step in the right direction. Could you please move the |
@radar done. rebased and remove all references to MailMethod. Please take a look. Running backend spec now, which take ages on my local machine. Hopefully should be good to go. |
Fixed a backend controller spec related to this change. Got another error I think it's unrelated:
|
Also ran frontend specs. Got same similar errors as above. I believe this one is good to go. |
Tentatively adding this to master now. Will run it over the CI server and see what it says. |
CI server says all is green. Thanks @huoxito. Goodbye, MailMethod. |
Awesome @radar ! However I've notice it not made it to spree/spree master yet. Tested a merge locally and relized it does not apply cleanly anymore. Would like me to rebase it again on top of master? |
Hm... I don't know where it went! Yes please rebase on master. |
Will do! |
- Deletes new and index templates from mail methods - Removes mail_method model spec. It adds value to the test suite - Fixes requests and controllers specs related to mail method refactoring
Moves them to /core/spec/lib since both MailInterceptor and MailSettings are classes from the /core package
And the class itself. I believe the spree_mail_methods table should stay for now so that can core team can talk about a strategy to advise users the best way to upgrade and docs are updated
Added to my master branch and running over CI. Thanks again @huoxito. On Fri, Apr 12, 2013 at 11:54 PM, Washington Júnior <
Ryan Bigg Register now for SpreeConf |
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Please give a look at the following links: - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists - spree/spree#2643
Said class is removed in spree/spree#2643 in Spree.
Said class is removed in spree/spree#2643 in Spree.
Said class is removed in spree/spree#2643 in Spree.
Said class is removed in spree/spree#2643 in Spree.
A suggestion to remove the mail_method obj (and table) from Spree and just use
Spree::Config
instead. I could never understand why Spree would keep a collection of mail methods when all it needs, and actually uses, is a single one. This method should prove it, it's called by bothSpree::Core::MailSetting
andSpree::Core::MailInterceptor
to override the action_mailer configs.Another reason to remove the MailMethod model is that the table only has an environment and an active attr, besides the Rails defaults (I believe the active attribute is not used anywhere). All other fields are preferences already.
If this get merged in users could use if statements to define custom settings as per environment. e.g.
Please let me know what you think. The build still has some failing specs but I think that's related to taxons or something else. I made it in four commits just to state clearly what were the changes. I could squash them into one in case you guys intend to merge it in master.