mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 05:18:01 +08:00
Merge branch 'features/small-improvements' into develop
This commit is contained in:
commit
169145c405
7 changed files with 17 additions and 26 deletions
|
@ -14,13 +14,13 @@ module MailerHelper
|
||||||
private
|
private
|
||||||
|
|
||||||
def prepend_server_url(href)
|
def prepend_server_url(href)
|
||||||
return href if href.start_with? ENV['MAIL_SERVER_URL']
|
return href if href.start_with? Rails.application.config.action_mailer.default_url_options[:host]
|
||||||
|
|
||||||
new_href = ''
|
new_href = ''
|
||||||
unless ENV['MAIL_SERVER_URL'].start_with?('http://', 'https://')
|
unless Rails.application.config.action_mailer.default_url_options[:host].start_with?('http://', 'https://')
|
||||||
new_href += 'http://'
|
new_href += 'http://'
|
||||||
end
|
end
|
||||||
new_href += ENV['MAIL_SERVER_URL']
|
new_href += Rails.application.config.action_mailer.default_url_options[:host]
|
||||||
new_href += ((href.start_with? '/') ? '' : '/')
|
new_href += ((href.start_with? '/') ? '' : '/')
|
||||||
new_href += href
|
new_href += href
|
||||||
new_href
|
new_href
|
||||||
|
|
|
@ -182,6 +182,6 @@ class ProjectsJsonExportService
|
||||||
end
|
end
|
||||||
|
|
||||||
def asset_url(asset)
|
def asset_url(asset)
|
||||||
ENV['MAIL_SERVER_URL'] + Rails.application.routes.url_helpers.asset_file_url_path(asset)
|
Rails.application.routes.url_helpers.asset_file_url_url(asset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,15 +42,17 @@ Rails.application.configure do
|
||||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||||
config.active_storage.service = ENV['ACTIVESTORAGE_SERVICE'] || :local
|
config.active_storage.service = ENV['ACTIVESTORAGE_SERVICE'] || :local
|
||||||
|
|
||||||
|
Rails.application.routes.default_url_options = {
|
||||||
|
host: ENV['WEB_SERVER_URL'] || ENV['MAIL_SERVER_URL'] || 'localhost'
|
||||||
|
}
|
||||||
|
|
||||||
|
config.action_mailer.default_url_options = { host: Rails.application.routes.default_url_options[:host] }
|
||||||
|
|
||||||
# Don't care if the mailer can't send.
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
config.action_mailer.perform_caching = false
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
Rails.application.routes.default_url_options = {
|
|
||||||
host: Rails.application.secrets.mail_server_url
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger.
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
@ -104,7 +106,6 @@ Rails.application.configure do
|
||||||
else
|
else
|
||||||
config.x.new_team_on_signup = false
|
config.x.new_team_on_signup = false
|
||||||
end
|
end
|
||||||
config.hosts << "dev.scinote.test"
|
|
||||||
|
|
||||||
# Automatically update js-routes file
|
# Automatically update js-routes file
|
||||||
# when routes.rb is changed
|
# when routes.rb is changed
|
||||||
|
|
|
@ -17,13 +17,10 @@ Rails.application.configure do
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
Rails.application.routes.default_url_options = {
|
Rails.application.routes.default_url_options = {
|
||||||
host: Rails.application.secrets.mail_server_url
|
host: ENV['WEB_SERVER_URL'] || ENV['MAIL_SERVER_URL']
|
||||||
}
|
}
|
||||||
|
|
||||||
# Don't care if the mailer can't send.
|
config.action_mailer.default_url_options = { host: Rails.application.routes.default_url_options[:host] }
|
||||||
config.action_mailer.default_url_options = {
|
|
||||||
host: Rails.application.secrets.mail_server_url
|
|
||||||
}
|
|
||||||
config.action_mailer.default_options = {
|
config.action_mailer.default_options = {
|
||||||
from: Rails.application.secrets.mailer_from,
|
from: Rails.application.secrets.mailer_from,
|
||||||
reply_to: Rails.application.secrets.mailer_reply_to
|
reply_to: Rails.application.secrets.mailer_reply_to
|
||||||
|
|
|
@ -36,12 +36,13 @@ Rails.application.configure do
|
||||||
# Store uploaded files on the local file system in a temporary directory.
|
# Store uploaded files on the local file system in a temporary directory.
|
||||||
config.active_storage.service = :test
|
config.active_storage.service = :test
|
||||||
|
|
||||||
config.action_mailer.perform_caching = false
|
|
||||||
|
|
||||||
Rails.application.routes.default_url_options = {
|
Rails.application.routes.default_url_options = {
|
||||||
host: Rails.application.secrets.mail_server_url
|
host: ENV['WEB_SERVER_URL'] || ENV['MAIL_SERVER_URL'] || 'localhost'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.action_mailer.default_url_options = { host: Rails.application.routes.default_url_options[:host] }
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
# Tell Action Mailer not to deliver emails to the real world.
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
|
|
|
@ -20,14 +20,6 @@
|
||||||
|
|
||||||
common: &common
|
common: &common
|
||||||
|
|
||||||
# ======================================================================
|
|
||||||
# Server address is used for mailer (in "confirm new email/..." emails,
|
|
||||||
# SciNote needs to know onto which URL to redirect the user for
|
|
||||||
# confirmation page)
|
|
||||||
# ======================================================================
|
|
||||||
|
|
||||||
mail_server_url: <%= ENV["MAIL_SERVER_URL"] || "localhost" %>
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
# Mailer configuration to define from which SMTP server to send
|
# Mailer configuration to define from which SMTP server to send
|
||||||
# e-mails.
|
# e-mails.
|
||||||
|
|
|
@ -5,7 +5,7 @@ require 'active_storage/service/disk_service'
|
||||||
module ActiveStorage
|
module ActiveStorage
|
||||||
class Service::CustomDiskService < Service::DiskService
|
class Service::CustomDiskService < Service::DiskService
|
||||||
def url_options
|
def url_options
|
||||||
ActiveStorage::Current.url_options ||= { host: Rails.application.secrets.mail_server_url }
|
ActiveStorage::Current.url_options ||= { host: Rails.application.routes.default_url_options[:host] }
|
||||||
ActiveStorage::Current.url_options
|
ActiveStorage::Current.url_options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue