مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
style(rubocop): Style/MutableConstant
هذا الالتزام موجود في:
@@ -23,7 +23,7 @@ class Credential < ApplicationRecord
|
||||
|
||||
belongs_to :server
|
||||
|
||||
TYPES = ["SMTP", "API", "SMTP-IP"]
|
||||
TYPES = ["SMTP", "API", "SMTP-IP"].freeze
|
||||
|
||||
validates :key, presence: true, uniqueness: { case_sensitive: false }
|
||||
validates :type, inclusion: { in: TYPES }
|
||||
|
||||
@@ -44,15 +44,14 @@ class Domain < ApplicationRecord
|
||||
|
||||
include HasDNSChecks
|
||||
|
||||
VERIFICATION_EMAIL_ALIASES = ["webmaster", "postmaster", "admin", "administrator", "hostmaster"]
|
||||
VERIFICATION_EMAIL_ALIASES = ["webmaster", "postmaster", "admin", "administrator", "hostmaster"].freeze
|
||||
VERIFICATION_METHODS = ["DNS", "Email"].freeze
|
||||
|
||||
belongs_to :server, optional: true
|
||||
belongs_to :owner, optional: true, polymorphic: true
|
||||
has_many :routes, dependent: :destroy
|
||||
has_many :track_domains, dependent: :destroy
|
||||
|
||||
VERIFICATION_METHODS = ["DNS", "Email"]
|
||||
|
||||
validates :name, presence: true, format: { with: /\A[a-z0-9\-.]*\z/ }, uniqueness: { case_sensitive: false, scope: [:owner_type, :owner_id], message: "is already added" }
|
||||
validates :verification_method, inclusion: { in: VERIFICATION_METHODS }
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ class HTTPEndpoint < ApplicationRecord
|
||||
has_many :routes, as: :endpoint
|
||||
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint
|
||||
|
||||
ENCODINGS = ["BodyAsJSON", "FormData"]
|
||||
FORMATS = ["Hash", "RawMessage"]
|
||||
ENCODINGS = ["BodyAsJSON", "FormData"].freeze
|
||||
FORMATS = ["Hash", "RawMessage"].freeze
|
||||
|
||||
before_destroy :update_routes
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
class Organization < ApplicationRecord
|
||||
|
||||
RESERVED_PERMALINKS = ["new", "edit", "remove", "delete", "destroy", "admin", "mail", "org", "server"]
|
||||
RESERVED_PERMALINKS = ["new", "edit", "remove", "delete", "destroy", "admin", "mail", "org", "server"].freeze
|
||||
|
||||
INITIAL_QUOTA = 10
|
||||
INITIAL_SUPER_QUOTA = 10_000
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
|
||||
class Route < ApplicationRecord
|
||||
|
||||
MODES = ["Endpoint", "Accept", "Hold", "Bounce", "Reject"]
|
||||
MODES = ["Endpoint", "Accept", "Hold", "Bounce", "Reject"].freeze
|
||||
SPAM_MODES = ["Mark", "Quarantine", "Fail"].freeze
|
||||
ENDPOINT_TYPES = ["SMTPEndpoint", "HTTPEndpoint", "AddressEndpoint"].freeze
|
||||
|
||||
include HasUUID
|
||||
|
||||
@@ -33,9 +35,6 @@ class Route < ApplicationRecord
|
||||
belongs_to :endpoint, polymorphic: true, optional: true
|
||||
has_many :additional_route_endpoints, dependent: :destroy
|
||||
|
||||
SPAM_MODES = ["Mark", "Quarantine", "Fail"]
|
||||
ENDPOINT_TYPES = ["SMTPEndpoint", "HTTPEndpoint", "AddressEndpoint"]
|
||||
|
||||
validates :name, presence: true, format: /\A(([a-z0-9\-.]*)|(\*)|(__returnpath__))\z/
|
||||
validates :spam_mode, inclusion: { in: SPAM_MODES }
|
||||
validates :endpoint, presence: { if: proc { mode == "Endpoint" } }
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
|
||||
class Server < ApplicationRecord
|
||||
|
||||
RESERVED_PERMALINKS = ["new", "all", "search", "stats", "edit", "manage", "delete", "destroy", "remove"]
|
||||
RESERVED_PERMALINKS = ["new", "all", "search", "stats", "edit", "manage", "delete", "destroy", "remove"].freeze
|
||||
MODES = ["Live", "Development"].freeze
|
||||
|
||||
include HasUUID
|
||||
include HasSoftDestroy
|
||||
@@ -64,8 +65,6 @@ class Server < ApplicationRecord
|
||||
has_many :track_domains, dependent: :destroy
|
||||
has_many :ip_pool_rules, dependent: :destroy, as: :owner
|
||||
|
||||
MODES = ["Live", "Development"]
|
||||
|
||||
random_string :token, type: :chars, length: 6, unique: true, upper_letters_only: true
|
||||
default_value :permalink, -> { name ? name.parameterize : nil }
|
||||
default_value :raw_message_retention_days, -> { 30 }
|
||||
|
||||
@@ -26,7 +26,7 @@ class SMTPEndpoint < ApplicationRecord
|
||||
has_many :routes, as: :endpoint
|
||||
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint
|
||||
|
||||
SSL_MODES = ["None", "Auto", "STARTTLS", "TLS"]
|
||||
SSL_MODES = ["None", "Auto", "STARTTLS", "TLS"].freeze
|
||||
|
||||
before_destroy :update_routes
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class WebhookEvent < ApplicationRecord
|
||||
"MessageLinkClicked",
|
||||
"MessageLoaded",
|
||||
"DomainDNSError"
|
||||
]
|
||||
].freeze
|
||||
|
||||
belongs_to :webhook
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class WebhookRequest < ApplicationRecord
|
||||
|
||||
include HasUUID
|
||||
|
||||
RETRIES = { 1 => 2.minutes, 2 => 3.minutes, 3 => 6.minutes, 4 => 10.minutes, 5 => 15.minutes }
|
||||
RETRIES = { 1 => 2.minutes, 2 => 3.minutes, 3 => 6.minutes, 4 => 10.minutes, 5 => 15.minutes }.freeze
|
||||
|
||||
belongs_to :server
|
||||
belongs_to :webhook, optional: true
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم