مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
chore: remove non-breaking spaces from comments
هذا الالتزام موجود في:
@@ -128,7 +128,7 @@ class Route < ApplicationRecord
|
|||||||
|
|
||||||
#
|
#
|
||||||
# This message will create a suitable number of message objects for messages that
|
# This message will create a suitable number of message objects for messages that
|
||||||
# are destined for this route. It receives a block which can set the message content
|
# are destined for this route. It receives a block which can set the message content
|
||||||
# but most information is specified already.
|
# but most information is specified already.
|
||||||
#
|
#
|
||||||
# Returns an array of created messages.
|
# Returns an array of created messages.
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module Postal
|
|||||||
result.output = response[:body].to_s[0, 500].strip
|
result.output = response[:body].to_s[0, 500].strip
|
||||||
end
|
end
|
||||||
if response[:code] >= 200 && response[:code] < 300
|
if response[:code] >= 200 && response[:code] < 300
|
||||||
# This is considered a success
|
# This is considered a success
|
||||||
result.type = "Sent"
|
result.type = "Sent"
|
||||||
elsif response[:code] >= 500 && response[:code] < 600
|
elsif response[:code] >= 500 && response[:code] < 600
|
||||||
# This is temporary. They might fix their server so it should soft fail.
|
# This is temporary. They might fix their server so it should soft fail.
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create a new message with the given attributes. This won't be saved to the database
|
# Create a new message with the given attributes. This won't be saved to the database
|
||||||
# until it has been 'save'd.
|
# until it has been 'save'd.
|
||||||
#
|
#
|
||||||
def new_message(attributes = {})
|
def new_message(attributes = {})
|
||||||
Message.new(self, attributes)
|
Message.new(self, attributes)
|
||||||
@@ -74,35 +74,35 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the live stats instance
|
# Return the live stats instance
|
||||||
#
|
#
|
||||||
def live_stats
|
def live_stats
|
||||||
@live_stats ||= LiveStats.new(self)
|
@live_stats ||= LiveStats.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the statistics instance
|
# Return the statistics instance
|
||||||
#
|
#
|
||||||
def statistics
|
def statistics
|
||||||
@statistics ||= Statistics.new(self)
|
@statistics ||= Statistics.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the provisioner instance
|
# Return the provisioner instance
|
||||||
#
|
#
|
||||||
def provisioner
|
def provisioner
|
||||||
@provisioner ||= Provisioner.new(self)
|
@provisioner ||= Provisioner.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the provisioner instance
|
# Return the provisioner instance
|
||||||
#
|
#
|
||||||
def suppression_list
|
def suppression_list
|
||||||
@suppression_list ||= SuppressionList.new(self)
|
@suppression_list ||= SuppressionList.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the provisioner instance
|
# Return the provisioner instance
|
||||||
#
|
#
|
||||||
def webhooks
|
def webhooks
|
||||||
@webhooks ||= Webhooks.new(self)
|
@webhooks ||= Webhooks.new(self)
|
||||||
@@ -183,7 +183,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# A paginated version of select
|
# A paginated version of select
|
||||||
#
|
#
|
||||||
def select_with_pagination(table, page, options = {})
|
def select_with_pagination(table, page, options = {})
|
||||||
page = page.to_i
|
page = page.to_i
|
||||||
@@ -253,7 +253,7 @@ module Postal
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Deletes a in the database. Accepts a table name, and some options which
|
# Deletes a in the database. Accepts a table name, and some options which
|
||||||
# are shown below:
|
# are shown below:
|
||||||
#
|
#
|
||||||
# :where => The condition to apply to the query
|
# :where => The condition to apply to the query
|
||||||
#
|
#
|
||||||
@@ -269,7 +269,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the correct database name
|
# Return the correct database name
|
||||||
#
|
#
|
||||||
def database_name
|
def database_name
|
||||||
@database_name ||= "#{Postal.config.message_db.prefix}-server-#{@server_id}"
|
@database_name ||= "#{Postal.config.message_db.prefix}-server-#{@server_id}"
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the time that the last delivery was attempted
|
# Return the time that the last delivery was attempted
|
||||||
#
|
#
|
||||||
def last_delivery_attempt
|
def last_delivery_attempt
|
||||||
@last_delivery_attempt ||= @attributes["last_delivery_attempt"] ? Time.zone.at(@attributes["last_delivery_attempt"]) : nil
|
@last_delivery_attempt ||= @attributes["last_delivery_attempt"] ? Time.zone.at(@attributes["last_delivery_attempt"]) : nil
|
||||||
@@ -172,14 +172,14 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return all activity entries
|
# Return all activity entries
|
||||||
#
|
#
|
||||||
def activity_entries
|
def activity_entries
|
||||||
@activity_entries ||= (deliveries + clicks + loads).sort_by(&:timestamp)
|
@activity_entries ||= (deliveries + clicks + loads).sort_by(&:timestamp)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provide access to set and get acceptable attributes
|
# Provide access to set and get acceptable attributes
|
||||||
#
|
#
|
||||||
def method_missing(name, value = nil, &block)
|
def method_missing(name, value = nil, &block)
|
||||||
if @attributes.key?(name.to_s)
|
if @attributes.key?(name.to_s)
|
||||||
@@ -202,7 +202,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Save this message
|
# Save this message
|
||||||
#
|
#
|
||||||
def save(queue_on_create: true)
|
def save(queue_on_create: true)
|
||||||
save_raw_message
|
save_raw_message
|
||||||
@@ -223,7 +223,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Delete the message from the database
|
# Delete the message from the database
|
||||||
#
|
#
|
||||||
def delete
|
def delete
|
||||||
return unless persisted?
|
return unless persisted?
|
||||||
@@ -232,7 +232,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the headers
|
# Return the headers
|
||||||
#
|
#
|
||||||
def raw_headers
|
def raw_headers
|
||||||
if raw_table
|
if raw_table
|
||||||
@@ -243,7 +243,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the full raw message body for this message.
|
# Return the full raw message body for this message.
|
||||||
#
|
#
|
||||||
def raw_body
|
def raw_body
|
||||||
if raw_table
|
if raw_table
|
||||||
@@ -303,7 +303,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the HTML body for this message
|
# Return the HTML body for this message
|
||||||
#
|
#
|
||||||
def html_body
|
def html_body
|
||||||
mail&.html_body
|
mail&.html_body
|
||||||
@@ -484,7 +484,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create a new link
|
# Create a new link
|
||||||
#
|
#
|
||||||
def create_link(url)
|
def create_link(url)
|
||||||
hash = Digest::SHA1.hexdigest(url.to_s)
|
hash = Digest::SHA1.hexdigest(url.to_s)
|
||||||
@@ -494,7 +494,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return a message object that this message is a reply to
|
# Return a message object that this message is a reply to
|
||||||
#
|
#
|
||||||
def original_messages
|
def original_messages
|
||||||
return nil unless bounce
|
return nil unless bounce
|
||||||
@@ -531,7 +531,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return all spam checks for this message
|
# Return all spam checks for this message
|
||||||
#
|
#
|
||||||
def spam_checks
|
def spam_checks
|
||||||
@spam_checks ||= database.select(:spam_checks, where: { message_id: id })
|
@spam_checks ||= database.select(:spam_checks, where: { message_id: id })
|
||||||
@@ -552,7 +552,7 @@ module Postal
|
|||||||
def parse_content
|
def parse_content
|
||||||
parse_result = Postal::MessageParser.new(self)
|
parse_result = Postal::MessageParser.new(self)
|
||||||
if parse_result.actioned?
|
if parse_result.actioned?
|
||||||
# Somethign was changed, update the raw message
|
# Somethign was changed, update the raw message
|
||||||
@database.update(raw_table, { data: parse_result.new_body }, where: { id: raw_body_id })
|
@database.update(raw_table, { data: parse_result.new_body }, where: { id: raw_body_id })
|
||||||
@database.update(raw_table, { data: parse_result.new_headers }, where: { id: raw_headers_id })
|
@database.update(raw_table, { data: parse_result.new_headers }, where: { id: raw_headers_id })
|
||||||
@raw = parse_result.new_body
|
@raw = parse_result.new_body
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove messages from the messages table that are too old to retain
|
# Remove messages from the messages table that are too old to retain
|
||||||
#
|
#
|
||||||
def remove_messages(max_age = 60)
|
def remove_messages(max_age = 60)
|
||||||
time = (Time.now.utc.to_date - max_age.days).to_time.end_of_day
|
time = (Time.now.utc.to_date - max_age.days).to_time.end_of_day
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم