مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-16 21:23:37 +00:00
style(rubocop): Style/WordArray
هذا الالتزام موجود في:
@@ -5,7 +5,7 @@ require "resolv"
|
|||||||
module HasDNSChecks
|
module HasDNSChecks
|
||||||
|
|
||||||
def dns_ok?
|
def dns_ok?
|
||||||
spf_status == "OK" && dkim_status == "OK" && ["OK", "Missing"].include?(mx_status) && ["OK", "Missing"].include?(return_path_status)
|
spf_status == "OK" && dkim_status == "OK" && %w[OK Missing].include?(mx_status) && %w[OK Missing].include?(return_path_status)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dns_checked?
|
def dns_checked?
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Credential < ApplicationRecord
|
|||||||
|
|
||||||
belongs_to :server
|
belongs_to :server
|
||||||
|
|
||||||
TYPES = ["SMTP", "API", "SMTP-IP"].freeze
|
TYPES = %w[SMTP API SMTP-IP].freeze
|
||||||
|
|
||||||
validates :key, presence: true, uniqueness: { case_sensitive: false }
|
validates :key, presence: true, uniqueness: { case_sensitive: false }
|
||||||
validates :type, inclusion: { in: TYPES }
|
validates :type, inclusion: { in: TYPES }
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ class Domain < ApplicationRecord
|
|||||||
|
|
||||||
include HasDNSChecks
|
include HasDNSChecks
|
||||||
|
|
||||||
VERIFICATION_EMAIL_ALIASES = ["webmaster", "postmaster", "admin", "administrator", "hostmaster"].freeze
|
VERIFICATION_EMAIL_ALIASES = %w[webmaster postmaster admin administrator hostmaster].freeze
|
||||||
VERIFICATION_METHODS = ["DNS", "Email"].freeze
|
VERIFICATION_METHODS = %w[DNS Email].freeze
|
||||||
|
|
||||||
belongs_to :server, optional: true
|
belongs_to :server, optional: true
|
||||||
belongs_to :owner, optional: true, polymorphic: true
|
belongs_to :owner, optional: true, polymorphic: true
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ class HTTPEndpoint < ApplicationRecord
|
|||||||
has_many :routes, as: :endpoint
|
has_many :routes, as: :endpoint
|
||||||
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint
|
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint
|
||||||
|
|
||||||
ENCODINGS = ["BodyAsJSON", "FormData"].freeze
|
ENCODINGS = %w[BodyAsJSON FormData].freeze
|
||||||
FORMATS = ["Hash", "RawMessage"].freeze
|
FORMATS = %w[Hash RawMessage].freeze
|
||||||
|
|
||||||
before_destroy :update_routes
|
before_destroy :update_routes
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class Organization < ApplicationRecord
|
class Organization < ApplicationRecord
|
||||||
|
|
||||||
RESERVED_PERMALINKS = ["new", "edit", "remove", "delete", "destroy", "admin", "mail", "org", "server"].freeze
|
RESERVED_PERMALINKS = %w[new edit remove delete destroy admin mail org server].freeze
|
||||||
|
|
||||||
INITIAL_QUOTA = 10
|
INITIAL_QUOTA = 10
|
||||||
INITIAL_SUPER_QUOTA = 10_000
|
INITIAL_SUPER_QUOTA = 10_000
|
||||||
|
|||||||
@@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
class Route < ApplicationRecord
|
class Route < ApplicationRecord
|
||||||
|
|
||||||
MODES = ["Endpoint", "Accept", "Hold", "Bounce", "Reject"].freeze
|
MODES = %w[Endpoint Accept Hold Bounce Reject].freeze
|
||||||
SPAM_MODES = ["Mark", "Quarantine", "Fail"].freeze
|
SPAM_MODES = %w[Mark Quarantine Fail].freeze
|
||||||
ENDPOINT_TYPES = ["SMTPEndpoint", "HTTPEndpoint", "AddressEndpoint"].freeze
|
ENDPOINT_TYPES = %w[SMTPEndpoint HTTPEndpoint AddressEndpoint].freeze
|
||||||
|
|
||||||
include HasUUID
|
include HasUUID
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,8 @@
|
|||||||
|
|
||||||
class Server < ApplicationRecord
|
class Server < ApplicationRecord
|
||||||
|
|
||||||
RESERVED_PERMALINKS = ["new", "all", "search", "stats", "edit", "manage", "delete", "destroy", "remove"].freeze
|
RESERVED_PERMALINKS = %w[new all search stats edit manage delete destroy remove].freeze
|
||||||
MODES = ["Live", "Development"].freeze
|
MODES = %w[Live Development].freeze
|
||||||
|
|
||||||
include HasUUID
|
include HasUUID
|
||||||
include HasSoftDestroy
|
include HasSoftDestroy
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class SMTPEndpoint < ApplicationRecord
|
|||||||
has_many :routes, as: :endpoint
|
has_many :routes, as: :endpoint
|
||||||
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint
|
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint
|
||||||
|
|
||||||
SSL_MODES = ["None", "Auto", "STARTTLS", "TLS"].freeze
|
SSL_MODES = %w[None Auto STARTTLS TLS].freeze
|
||||||
|
|
||||||
before_destroy :update_routes
|
before_destroy :update_routes
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,15 @@
|
|||||||
|
|
||||||
class WebhookEvent < ApplicationRecord
|
class WebhookEvent < ApplicationRecord
|
||||||
|
|
||||||
EVENTS = [
|
EVENTS = %w[
|
||||||
"MessageSent",
|
MessageSent
|
||||||
"MessageDelayed",
|
MessageDelayed
|
||||||
"MessageDeliveryFailed",
|
MessageDeliveryFailed
|
||||||
"MessageHeld",
|
MessageHeld
|
||||||
"MessageBounced",
|
MessageBounced
|
||||||
"MessageLinkClicked",
|
MessageLinkClicked
|
||||||
"MessageLoaded",
|
MessageLoaded
|
||||||
"DomainDNSError"
|
DomainDNSError
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
belongs_to :webhook
|
belongs_to :webhook
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
if options[:order]
|
if options[:order]
|
||||||
direction = (options[:direction] || "ASC").upcase
|
direction = (options[:direction] || "ASC").upcase
|
||||||
raise Postal::Error, "Invalid direction #{options[:direction]}" unless ["ASC", "DESC"].include?(direction)
|
raise Postal::Error, "Invalid direction #{options[:direction]}" unless %w[ASC DESC].include?(direction)
|
||||||
|
|
||||||
sql_query << " ORDER BY `#{options[:order]}` #{direction}"
|
sql_query << " ORDER BY `#{options[:order]}` #{direction}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ module Postal
|
|||||||
# environment and can be quite dangerous in production.
|
# environment and can be quite dangerous in production.
|
||||||
#
|
#
|
||||||
def clean
|
def clean
|
||||||
["clicks", "deliveries", "links", "live_stats", "loads", "messages",
|
%w[clicks deliveries links live_stats loads messages
|
||||||
"raw_message_sizes", "spam_checks", "stats_daily", "stats_hourly",
|
raw_message_sizes spam_checks stats_daily stats_hourly
|
||||||
"stats_monthly", "stats_yearly", "suppressions", "webhook_requests"].each do |table|
|
stats_monthly stats_yearly suppressions webhook_requests].each do |table|
|
||||||
@database.query("TRUNCATE `#{@database.database_name}`.`#{table}`")
|
@database.query("TRUNCATE `#{@database.database_name}`.`#{table}`")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم