مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-17 13:39:46 +00:00
style(rubocop): Lint/UnusedBlockArgument
هذا الالتزام موجود في:
@@ -85,7 +85,7 @@ class Domain < ApplicationRecord
|
|||||||
|
|
||||||
def parent_domains
|
def parent_domains
|
||||||
parts = name.split(".")
|
parts = name.split(".")
|
||||||
parts[0, parts.size - 1].each_with_index.map do |p, i|
|
parts[0, parts.size - 1].each_with_index.map do |_, i|
|
||||||
parts[i..-1].join(".")
|
parts[i..-1].join(".")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class OutgoingMessagePrototype
|
|||||||
end
|
end
|
||||||
|
|
||||||
if attachments.present?
|
if attachments.present?
|
||||||
attachments.each_with_index do |attachment, index|
|
attachments.each do |attachment|
|
||||||
if attachment[:name].blank?
|
if attachment[:name].blank?
|
||||||
@errors << "AttachmentMissingName" unless @errors.include?("AttachmentMissingName")
|
@errors << "AttachmentMissingName" unless @errors.include?("AttachmentMissingName")
|
||||||
elsif attachment[:data].blank?
|
elsif attachment[:data].blank?
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class Route < ApplicationRecord
|
|||||||
if route.save
|
if route.save
|
||||||
seen << route.id
|
seen << route.id
|
||||||
else
|
else
|
||||||
route.errors.each do |field, message|
|
route.errors.each do |_, message|
|
||||||
errors.add :base, message
|
errors.add :base, message
|
||||||
end
|
end
|
||||||
raise ActiveRecord::RecordInvalid
|
raise ActiveRecord::RecordInvalid
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class Server < ApplicationRecord
|
|||||||
time = Time.now.utc
|
time = Time.now.utc
|
||||||
total_outgoing = 0.0
|
total_outgoing = 0.0
|
||||||
total_bounces = 0.0
|
total_bounces = 0.0
|
||||||
message_db.statistics.get(:daily, [:outgoing, :bounces], time, 30).each do |date, stat|
|
message_db.statistics.get(:daily, [:outgoing, :bounces], time, 30).each do |_, stat|
|
||||||
total_outgoing += stat[:outgoing]
|
total_outgoing += stat[:outgoing]
|
||||||
total_bounces += stat[:bounces]
|
total_bounces += stat[:bounces]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module Postal
|
|||||||
config.eager_load_paths << Rails.root.join("lib")
|
config.eager_load_paths << Rails.root.join("lib")
|
||||||
|
|
||||||
# Disable field_with_errors
|
# Disable field_with_errors
|
||||||
config.action_view.field_error_proc = proc { |t, i| t }
|
config.action_view.field_error_proc = proc { |t, _| t }
|
||||||
|
|
||||||
# Load the tracking server middleware
|
# Load the tracking server middleware
|
||||||
require "postal/tracking_middleware"
|
require "postal/tracking_middleware"
|
||||||
|
|||||||
@@ -553,14 +553,14 @@ module Postal
|
|||||||
private
|
private
|
||||||
|
|
||||||
def _update
|
def _update
|
||||||
@database.update("messages", @attributes.reject { |k, v| k == :id }, where: { id: @attributes["id"] })
|
@database.update("messages", @attributes.reject { |k, _| k == :id }, where: { id: @attributes["id"] })
|
||||||
end
|
end
|
||||||
|
|
||||||
def _create
|
def _create
|
||||||
self.timestamp = Time.now.to_f if timestamp.blank?
|
self.timestamp = Time.now.to_f if timestamp.blank?
|
||||||
self.status = "Pending" if status.blank?
|
self.status = "Pending" if status.blank?
|
||||||
self.token = Nifty::Utils::RandomString.generate(length: 12) if token.blank?
|
self.token = Nifty::Utils::RandomString.generate(length: 12) if token.blank?
|
||||||
last_id = @database.insert("messages", @attributes.reject { |k, v| k == :id })
|
last_id = @database.insert("messages", @attributes.reject { |k, _| k == :id })
|
||||||
@attributes["id"] = last_id
|
@attributes["id"] = last_id
|
||||||
@database.statistics.increment_all(timestamp, scope)
|
@database.statistics.increment_all(timestamp, scope)
|
||||||
Statistic.global.increment!(:total_messages)
|
Statistic.global.increment!(:total_messages)
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ module Postal
|
|||||||
authenticate(password)
|
authenticate(password)
|
||||||
end
|
end
|
||||||
|
|
||||||
username_handler = proc do |data|
|
username_handler = proc do
|
||||||
@proc = password_handler
|
@proc = password_handler
|
||||||
@password_expected_next = true
|
@password_expected_next = true
|
||||||
"334 UGFzc3dvcmQ6" # "Password:"
|
"334 UGFzc3dvcmQ6" # "Password:"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ describe Postal::MessageDB::ConnectionPool do
|
|||||||
|
|
||||||
it "checks in a connection if theres an error in the block" do
|
it "checks in a connection if theres an error in the block" do
|
||||||
expect do
|
expect do
|
||||||
pool.use do |c|
|
pool.use do
|
||||||
raise StandardError
|
raise StandardError
|
||||||
end
|
end
|
||||||
end.to raise_error StandardError
|
end.to raise_error StandardError
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم