مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
style(rubocop): Lint/UselessAssignment
هذا الالتزام موجود في:
@@ -14,7 +14,7 @@ controller :messages do
|
||||
action do
|
||||
begin
|
||||
message = identity.server.message(params.id)
|
||||
rescue Postal::MessageDB::Message::NotFound => e
|
||||
rescue Postal::MessageDB::Message::NotFound
|
||||
error "MessageNotFound", id: params.id
|
||||
end
|
||||
structure :message, message, return: true
|
||||
@@ -30,7 +30,7 @@ controller :messages do
|
||||
action do
|
||||
begin
|
||||
message = identity.server.message(params.id)
|
||||
rescue Postal::MessageDB::Message::NotFound => e
|
||||
rescue Postal::MessageDB::Message::NotFound
|
||||
error "MessageNotFound", id: params.id
|
||||
end
|
||||
message.deliveries.map do |d|
|
||||
|
||||
@@ -33,7 +33,7 @@ class IPPoolsController < ApplicationController
|
||||
def destroy
|
||||
@ip_pool.destroy
|
||||
redirect_to_with_json :ip_pools, notice: "IP pool has been removed successfully."
|
||||
rescue ActiveRecord::DeleteRestrictionError => e
|
||||
rescue ActiveRecord::DeleteRestrictionError
|
||||
redirect_to_with_json [:edit, @ip_pool], alert: "IP pool cannot be removed because it still has associated addresses or servers."
|
||||
end
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ class MessagesController < ApplicationController
|
||||
if qs[:before]
|
||||
begin
|
||||
options[:where][:timestamp][:less_than] = get_time_from_string(qs[:before]).to_f
|
||||
rescue TimeUndetermined => e
|
||||
rescue TimeUndetermined
|
||||
flash.now[:alert] = "Couldn't determine time for before from '#{qs[:before]}'"
|
||||
end
|
||||
end
|
||||
@@ -196,7 +196,7 @@ class MessagesController < ApplicationController
|
||||
if qs[:after]
|
||||
begin
|
||||
options[:where][:timestamp][:greater_than] = get_time_from_string(qs[:after]).to_f
|
||||
rescue TimeUndetermined => e
|
||||
rescue TimeUndetermined
|
||||
flash.now[:alert] = "Couldn't determine time for after from '#{qs[:after]}'"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ class SessionsController < ApplicationController
|
||||
login(User.authenticate(params[:email_address], params[:password]))
|
||||
flash[:remember_login] = true
|
||||
redirect_to_with_return_to root_path
|
||||
rescue Postal::Errors::AuthenticationError => e
|
||||
rescue Postal::Errors::AuthenticationError
|
||||
flash.now[:alert] = "The credentials you've provided are incorrect. Please check and try again."
|
||||
render "new"
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class IncomingMessagePrototype
|
||||
def route
|
||||
@routes ||= if @to.present?
|
||||
uname, domain = @to.split("@", 2)
|
||||
uname, tag = uname.split("+", 2)
|
||||
uname, _tag = uname.split("+", 2)
|
||||
@server.routes.includes(:domain).where(domains: { name: domain }, name: uname).first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ class Organization < ApplicationRecord
|
||||
has_many :ip_pool_rules, dependent: :destroy, as: :owner
|
||||
|
||||
after_create do
|
||||
if pool = IPPool.default
|
||||
if IPPool.default
|
||||
ip_pools << IPPool.default
|
||||
end
|
||||
end
|
||||
|
||||
@@ -202,7 +202,7 @@ class Route < ApplicationRecord
|
||||
if route = Route.includes(:domain).where(domains: { name: domain.name }, name: name).where.not(id: id).first
|
||||
errors.add :name, "is configured on the #{route.server.full_permalink} mail server"
|
||||
end
|
||||
elsif route = Route.where(name: "__returnpath__").where.not(id: id).exists?
|
||||
elsif Route.where(name: "__returnpath__").where.not(id: id).exists?
|
||||
errors.add :base, "A return path route already exists for this server"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -232,8 +232,6 @@ class Server < ApplicationRecord
|
||||
return nil unless uname
|
||||
return nil unless domain_name
|
||||
|
||||
uname, = uname.split("+", 2)
|
||||
|
||||
# Find a verified domain which directly matches the domain name for the given address.
|
||||
domain = Domain.verified
|
||||
.order(owner_type: :desc)
|
||||
|
||||
@@ -26,7 +26,7 @@ module Postal
|
||||
message
|
||||
end
|
||||
n.notify!(short_message: message_without_ansi, log_name: @log_name, facility: "postal", application_name: "postal", process_name: ENV.fetch("PROC_NAME", nil), pid: Process.pid)
|
||||
rescue StandardError => e
|
||||
rescue StandardError
|
||||
# Can't log this to GELF. Soz.
|
||||
end
|
||||
end
|
||||
|
||||
@@ -64,29 +64,29 @@ module Postal
|
||||
code: result.code.to_i,
|
||||
body: result.body,
|
||||
headers: result.to_hash,
|
||||
secure: @ssl
|
||||
secure: ssl
|
||||
}
|
||||
end
|
||||
rescue OpenSSL::SSL::SSLError => e
|
||||
rescue OpenSSL::SSL::SSLError
|
||||
{
|
||||
code: -3,
|
||||
body: "Invalid SSL certificate",
|
||||
headers: {},
|
||||
secure: @ssl
|
||||
secure: ssl
|
||||
}
|
||||
rescue SocketError, Errno::ECONNRESET, EOFError, Errno::EINVAL, Errno::ENETUNREACH, Errno::EHOSTUNREACH, Errno::ECONNREFUSED => e
|
||||
{
|
||||
code: -2,
|
||||
body: e.message,
|
||||
headers: {},
|
||||
secure: @ssl
|
||||
secure: ssl
|
||||
}
|
||||
rescue Timeout::Error => e
|
||||
rescue Timeout::Error
|
||||
{
|
||||
code: -1,
|
||||
body: "Timed out after #{timeout}s",
|
||||
headers: {},
|
||||
secure: @ssl
|
||||
secure: ssl
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ module Postal
|
||||
# Get a statistic (or statistics)
|
||||
#
|
||||
def get(type, counters, start_date = Time.now, quantity = 10)
|
||||
date = start_date.utc
|
||||
start_date = start_date.utc
|
||||
items = quantity.times.each_with_object({}) do |i, hash|
|
||||
hash[(start_date - i.send(STATS_GAPS[type])).send("beginning_of_#{STATS_GAPS[type]}").utc] = counters.each_with_object({}) do |c, h|
|
||||
h[c] = 0
|
||||
|
||||
@@ -17,7 +17,7 @@ describe Postal::MessageParser do
|
||||
it "should replace links in messages" do
|
||||
with_global_server do |server|
|
||||
message = create_plain_text_message(server, "Hello world! http://github.com/atech/postal", "test@example.com")
|
||||
track_domain = create(:track_domain, server: server, domain: message.domain)
|
||||
create(:track_domain, server: server, domain: message.domain)
|
||||
parser = Postal::MessageParser.new(message)
|
||||
expect(parser.actioned?).to be true
|
||||
expect(parser.new_body).to match(/^Hello world! https:\/\/click\.#{message.domain.name}/)
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم