1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-01-17 13:39:46 +00:00

hide away IP pool things in the UI if not enabled

هذا الالتزام موجود في:
Adam Cooke
2017-04-27 09:41:21 +01:00
الأصل 1f64c61105
التزام 61da4bf48c
6 ملفات معدلة مع 12 إضافات و16 حذوفات

عرض الملف

@@ -64,7 +64,7 @@ class QueuedMessage < ApplicationRecord
end end
def allocate_ip_address def allocate_ip_address
if Postal.config.general.use_ip_pools && self.message && pool = self.server.ip_pool_for_message(self.message) if Postal.ip_pools? && self.message && pool = self.server.ip_pool_for_message(self.message)
self.ip_address = pool.ip_addresses.order("RAND()").first self.ip_address = pool.ip_addresses.order("RAND()").first
end end
end end

عرض الملف

@@ -47,7 +47,7 @@ class Server < ApplicationRecord
include HasSoftDestroy include HasSoftDestroy
belongs_to :organization belongs_to :organization
belongs_to :ip_pool belongs_to :ip_pool, :optional => true
has_many :domains, :dependent => :destroy, :as => :owner has_many :domains, :dependent => :destroy, :as => :owner
has_many :credentials, :dependent => :destroy has_many :credentials, :dependent => :destroy
has_many :smtp_endpoints, :dependent => :destroy has_many :smtp_endpoints, :dependent => :destroy
@@ -280,7 +280,6 @@ class Server < ApplicationRecord
def ip_pool_for_message(message) def ip_pool_for_message(message)
if message.scope == 'outgoing' if message.scope == 'outgoing'
[self, self.organization].each do |scope| [self, self.organization].each do |scope|
rules = scope.ip_pool_rules.order(:created_at => :desc) rules = scope.ip_pool_rules.order(:created_at => :desc)
rules.each do |rule| rules.each do |rule|
@@ -289,7 +288,6 @@ class Server < ApplicationRecord
end end
end end
end end
self.ip_pool self.ip_pool
else else
nil nil

عرض الملف

@@ -39,7 +39,7 @@
%li.siteHeader__subMenuItem= link_to "Switch organization", root_path, :class => 'siteHeader__subMenuLink' %li.siteHeader__subMenuItem= link_to "Switch organization", root_path, :class => 'siteHeader__subMenuLink'
%li.siteHeader__navItem.siteHeader__navItem--user= current_user.name %li.siteHeader__navItem.siteHeader__navItem--user= current_user.name
%li.siteHeader__navItem= link_to "My Settings", settings_path, :class => 'sideHeader__navItemLink' %li.siteHeader__navItem= link_to "My Settings", settings_path, :class => 'sideHeader__navItemLink'
- if current_user.admin? - if current_user.admin? && Postal.ip_pools?
%li.siteHeader__navItem= link_to "IP Pools", ip_pools_path, :class => 'sideHeader__navItemLink' %li.siteHeader__navItem= link_to "IP Pools", ip_pools_path, :class => 'sideHeader__navItemLink'
%li.siteHeader__navItem= link_to "Logout", logout_path, :method => :delete, :class => 'sideHeader__navItemLink' %li.siteHeader__navItem= link_to "Logout", logout_path, :method => :delete, :class => 'sideHeader__navItemLink'

عرض الملف

@@ -21,12 +21,13 @@
outgoing & incoming mail will be held and only visible in the web interface and will not be outgoing & incoming mail will be held and only visible in the web interface and will not be
sent to any recipients or HTTP endpoints. sent to any recipients or HTTP endpoints.
.fieldSet__field - if Postal.ip_pools?
= f.label :ip_pool_id, :class => 'fieldSet__label' .fieldSet__field
.fieldSet__input = f.label :ip_pool_id, :class => 'fieldSet__label'
= f.collection_select :ip_pool_id, organization.ip_pools.includes(:ip_addresses).order("`default` desc, name asc"), :id, :description, {}, :class => 'input input--select' .fieldSet__input
%p.fieldSet__text = f.collection_select :ip_pool_id, organization.ip_pools.includes(:ip_addresses).order("`default` desc, name asc"), :id, :description, {}, :class => 'input input--select'
This is the set of IP addresses which outbound e-mails will be delivered from. %p.fieldSet__text
This is the set of IP addresses which outbound e-mails will be delivered from.
- if @server.persisted? - if @server.persisted?
.fieldSet__field .fieldSet__field

عرض الملف

@@ -14,7 +14,8 @@
%li.serverHeader__list--warning= link_to "#{pluralize bad_dns, 'domain'} has misconfigured DNS records", [organization, @server, :domains] %li.serverHeader__list--warning= link_to "#{pluralize bad_dns, 'domain'} has misconfigured DNS records", [organization, @server, :domains]
- if unverified > 0 - if unverified > 0
%li= link_to "#{pluralize unverified, 'domain'} is awaiting verification", [organization, @server, :domains] %li= link_to "#{pluralize unverified, 'domain'} is awaiting verification", [organization, @server, :domains]
%li Sending via #{@server.ip_pool.name} - if Postal.ip_pools?
%li Sending via #{@server.ip_pool.name}
.serverHeader__stats{"data-turbolinks-permanent" => true, :id => "serverStats-#{@server.uuid}"} .serverHeader__stats{"data-turbolinks-permanent" => true, :id => "serverStats-#{@server.uuid}"}
%ul.serverHeader__statsList %ul.serverHeader__statsList

عرض الملف

@@ -1,7 +1,3 @@
ip_pool = IPPool.create!(:name => "Shared IP Pool", :type => 'Transactional', :default => true)
ip_pool.ip_addresses.create!(:ipv4 => "10.1.1.1", :ipv6 => "2a03:1234:a:1::1", :hostname => "i2.mx.example.com")
ip_pool.ip_addresses.create!(:ipv4 => "10.1.1.2", :ipv6 => "2a03:1234:a:1::2", :hostname => "i3.mx.example.com")
user = User.create!(:first_name => "Example", :last_name => "Admin", :email_address => "admin@example.com", :password => "password", :time_zone => "London", :email_verified_at => Time.now, :admin => true) user = User.create!(:first_name => "Example", :last_name => "Admin", :email_address => "admin@example.com", :password => "password", :time_zone => "London", :email_verified_at => Time.now, :admin => true)
org = Organization.create!(:name => "Acme Inc", :permalink => "acme", :time_zone => "London", :owner => user) org = Organization.create!(:name => "Acme Inc", :permalink => "acme", :time_zone => "London", :owner => user)