Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Desenv - adds the ability to set the from email #95

Closed
wants to merge 7 commits into from

2 participants

@gustavosoares

Adds the ability to set the from email instead of the hardcoded
noreply@domain.

@ugisozols
Owner

Hey @gustavosoares,

Sorry, I completely missed this PR. Do you have time to make this mergable again?

@ugisozols ugisozols commented on the diff
app/mailers/refinery/inquiries/inquiry_mailer.rb
@@ -14,7 +14,7 @@ def notification(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.notification_subject,
:to => Refinery::Inquiries::Setting.notification_recipients,
- :from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>"
+ :from => "\"#{Refinery::Core.site_name}\" <#{Refinery::Inquiries.inquiry_from_email}>",
@ugisozols Owner

Indent it as it was previously + we don't need , at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ugisozols ugisozols commented on the diff
app/mailers/refinery/inquiries/inquiry_mailer.rb
@@ -6,7 +6,7 @@ def confirmation(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
:to => inquiry.email,
- :from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>",
+ :from => "\"#{Refinery::Core.site_name}\" <#{Refinery::Inquiries.inquiry_from_email}>",
@ugisozols Owner

I like request.domain because then user doesn't have to configure yet another thing. Maybe we could set Refinery::Inquiries.inquiry_from_email to nil by default and use something like this:

def from(request)
  Refinery::Inquiries.inquiry_from_email || "no-reply@#{request.domain}"
end

....

mail :from => "\"#{Refinery::Core.site_name}\" <#{from(request)}>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ugisozols ugisozols closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  Rakefile
@@ -17,3 +17,5 @@ Refinery::Testing::Railtie.load_tasks
Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
load File.expand_path('../tasks/rspec.rake', __FILE__)
+
+task :default => :spec
View
2  app/controllers/refinery/inquiries/admin/inquiries_controller.rb
@@ -41,7 +41,7 @@ def find_all_spam
end
def get_spam_count
- @spam_count = Refinery::Inquiries::Inquiry.count(:conditions => {:spam => true})
+ @spam_count = Refinery::Inquiries::Inquiry.where(:spam => true).count
end
end
View
4 app/mailers/refinery/inquiries/inquiry_mailer.rb
@@ -6,7 +6,7 @@ def confirmation(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
:to => inquiry.email,
- :from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>",
+ :from => "\"#{Refinery::Core.site_name}\" <#{Refinery::Inquiries.inquiry_from_email}>",
@ugisozols Owner

I like request.domain because then user doesn't have to configure yet another thing. Maybe we could set Refinery::Inquiries.inquiry_from_email to nil by default and use something like this:

def from(request)
  Refinery::Inquiries.inquiry_from_email || "no-reply@#{request.domain}"
end

....

mail :from => "\"#{Refinery::Core.site_name}\" <#{from(request)}>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
:reply_to => Refinery::Inquiries::Setting.notification_recipients.split(',').first
end
@@ -14,7 +14,7 @@ def notification(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.notification_subject,
:to => Refinery::Inquiries::Setting.notification_recipients,
- :from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>"
+ :from => "\"#{Refinery::Core.site_name}\" <#{Refinery::Inquiries.inquiry_from_email}>",
@ugisozols Owner

Indent it as it was previously + we don't need , at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
end
View
6 app/views/refinery/inquiries/admin/inquiries/_inquiry.html.erb
@@ -1,14 +1,16 @@
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<%= link_to inquiry.name, refinery.inquiries_admin_inquiry_path(inquiry) %> <%= t('.said') %>
- <span class="preview"><%= truncate(strip_tags(inquiry.message), :length => 60) -%></span>
+ <span class="preview"><%= truncate(strip_tags(sanitize(inquiry.message)), :length => 60) -%></span>
</span>
<span class='actions'>
<%= link_to refinery_icon_tag('delete.png'),
refinery.inquiries_admin_inquiry_path(inquiry),
:class => "cancel confirm-delete",
:title => t('refinery.inquiries.admin.inquiries.delete'),
- :confirm => t('refinery.admin.delete.message', :title => inquiry.name),
+ :data => {
+ :confirm => t('refinery.admin.delete.message', :title => inquiry.name)
+ },
:method => :delete -%>
<%= link_to refinery_icon_tag('zoom.png'), refinery.inquiries_admin_inquiry_path(inquiry),
View
4 app/views/refinery/inquiries/admin/inquiries/show.html.erb
@@ -20,7 +20,9 @@
refinery.inquiries_admin_inquiry_path(@inquiry),
:class => 'delete_icon no-tooltip confirm-delete',
:title => t('refinery.inquiries.admin.inquiries.delete'),
- :confirm => t('refinery.admin.delete.message', :title => @inquiry.name),
+ :data => {
+ :confirm => t('refinery.admin.delete.message', :title => @inquiry.name)
+ },
:method => :delete %>
</li>
</ul>
View
2  app/views/refinery/inquiries/admin/settings/_confirmation_email_form.html.erb
@@ -20,7 +20,7 @@
<label class='stripped'><%= t('.from') %></label>
</td>
<td>
- <%= "#{Refinery::Core.site_name} &lt;no-reply@#{request.domain}&gt;".html_safe %>
+ <%= "#{Refinery::Core.site_name} &lt;#{Refinery::Inquiries.inquiry_from_email}&gt;".html_safe %>
</td>
</tr>
<% (defined?(Refinery::I18n) && Refinery::I18n.frontend_locales || [::I18n.locale]).each do |locale| %>
View
2  app/views/refinery/inquiries/inquiries/new.html.erb
@@ -1,4 +1,4 @@
-<% content_for :body_content_left do %>
+<% content_for :body do %>
<div class='inquiries'>
<%= form_for [refinery, :inquiries, @inquiry] do |f| %>
<%= render :partial => "/refinery/admin/error_messages",
View
3  lib/generators/refinery/inquiries/templates/config/initializers/refinery/inquiries.rb.erb
@@ -1,4 +1,5 @@
Refinery::Inquiries.configure do |config|
# Configure whether to show privacy link
# config.show_contact_privacy_link = <%= Refinery::Inquiries.show_contact_privacy_link.inspect %>
-end
+ # config.inquiry_from_email = <%= Refinery::Inquiries.inquiry_from_email.inspect %>
+end
View
1  lib/refinery/inquiries.rb
@@ -1,6 +1,7 @@
require 'refinerycms-core'
require 'refinerycms-settings'
require 'filters_spam'
+require 'acts_as_indexed'
module Refinery
autoload :InquiriesGenerator, 'generators/refinery/inquiries/inquiries_generator'
View
6 lib/refinery/inquiries/configuration.rb
@@ -2,8 +2,10 @@ module Refinery
module Inquiries
include ActiveSupport::Configurable
- config_accessor :show_contact_privacy_link
+ config_accessor :show_contact_privacy_link, :inquiry_from_email
self.show_contact_privacy_link = true
+ self.inquiry_from_email = "no-reply@localhost"
+
end
-end
+end
Something went wrong with that request. Please try again.