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