مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
chore: upgrade rails to 7.0 and other dependencies
هذا الالتزام موجود في:
@@ -109,7 +109,8 @@ class ApplicationController < ActionController::Base
|
||||
auth_session.invalidate!
|
||||
reset_session
|
||||
end
|
||||
Authie::Session.start(self, user: user)
|
||||
|
||||
create_auth_session(user)
|
||||
@current_user = user
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class MessagesController < ApplicationController
|
||||
@message.from = "test@#{domain.name}"
|
||||
end
|
||||
end
|
||||
@message.subject = "Test Message at #{Time.zone.now.to_s(:long)}"
|
||||
@message.subject = "Test Message at #{Time.zone.now.to_fs(:long)}"
|
||||
@message.plain_body = "This is a message to test the delivery of messages through Postal."
|
||||
end
|
||||
|
||||
|
||||
@@ -8,13 +8,7 @@ module HasAuthentication
|
||||
has_secure_password
|
||||
|
||||
validates :password, length: { minimum: 8, allow_blank: true }
|
||||
|
||||
when_attribute :password_digest, changes_to: :anything do
|
||||
before_save do
|
||||
self.password_reset_token = nil
|
||||
self.password_reset_token_valid_until = nil
|
||||
end
|
||||
end
|
||||
before_save :clear_password_reset_token_on_password_change
|
||||
end
|
||||
|
||||
class_methods do
|
||||
@@ -42,6 +36,15 @@ module HasAuthentication
|
||||
AppMailer.password_reset(self, return_to).deliver
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def clear_password_reset_token_on_password_change
|
||||
return unless password_digest_changed?
|
||||
|
||||
self.password_reset_token = nil
|
||||
self.password_reset_token_valid_until = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# -*- SkipSchemaAnnotations
|
||||
|
||||
@@ -39,7 +39,7 @@ class Credential < ApplicationRecord
|
||||
return if type == "SMTP-IP"
|
||||
return if persisted?
|
||||
|
||||
self.key = SecureRandomString.new(24)
|
||||
self.key = SecureRandom.alphanumeric(24)
|
||||
end
|
||||
|
||||
def to_param
|
||||
|
||||
@@ -61,17 +61,7 @@ class Domain < ApplicationRecord
|
||||
|
||||
scope :verified, -> { where.not(verified_at: nil) }
|
||||
|
||||
when_attribute :verification_method, changes_to: :anything do
|
||||
before_save do
|
||||
if verification_method == "DNS"
|
||||
self.verification_token = Nifty::Utils::RandomString.generate(length: 32)
|
||||
elsif verification_method == "Email"
|
||||
self.verification_token = rand(999_999).to_s.ljust(6, "0")
|
||||
else
|
||||
self.verification_token = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
before_save :update_verification_token_on_method_change
|
||||
|
||||
def verified?
|
||||
verified_at.present?
|
||||
@@ -168,4 +158,18 @@ class Domain < ApplicationRecord
|
||||
false
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_verification_token_on_method_change
|
||||
return unless verification_method_changed?
|
||||
|
||||
if verification_method == "DNS"
|
||||
self.verification_token = Nifty::Utils::RandomString.generate(length: 32)
|
||||
elsif verification_method == "Email"
|
||||
self.verification_token = rand(999_999).to_s.ljust(6, "0")
|
||||
else
|
||||
self.verification_token = nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -35,12 +35,7 @@ class Webhook < ApplicationRecord
|
||||
scope :enabled, -> { where(enabled: true) }
|
||||
|
||||
after_save :save_events
|
||||
|
||||
when_attribute :all_events, changes_to: true do
|
||||
after_save do
|
||||
webhook_events.destroy_all
|
||||
end
|
||||
end
|
||||
after_save :destroy_events_when_all_events_enabled
|
||||
|
||||
def events
|
||||
@events ||= webhook_events.map(&:event)
|
||||
@@ -50,13 +45,22 @@ class Webhook < ApplicationRecord
|
||||
@events = value.map(&:to_s).select(&:present?)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def save_events
|
||||
return unless @events
|
||||
|
||||
@events.each do |event|
|
||||
webhook_events.where(event: event).first_or_create!
|
||||
end
|
||||
|
||||
webhook_events.where.not(event: @events).destroy_all
|
||||
end
|
||||
|
||||
def destroy_events_when_all_events_enabled
|
||||
return unless all_events
|
||||
|
||||
webhook_events.destroy_all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
%ul.domainList__properties
|
||||
- if domain.verified?
|
||||
%li.domainList__verificationTime Verified on #{domain.verified_at.to_s(:long)}
|
||||
%li.domainList__verificationTime Verified on #{domain.verified_at.to_fs(:long)}
|
||||
- else
|
||||
%li= link_to "Verify this domain", [:verify, organization, @server, domain], :class => "domainList__verificationLink"
|
||||
%li.domainList__links
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
%p
|
||||
This message has been held. By releasing the message, we will allow it to continue on its way to its destination.
|
||||
- if @message.hold_expiry
|
||||
It will be held until #{@message.hold_expiry.to_s(:long)}.
|
||||
It will be held until #{@message.hold_expiry.to_fs(:long)}.
|
||||
%p.buttonSet
|
||||
= link_to "Release message", retry_organization_server_message_path(organization, @server, message.id), :class => "button button--small", :remote => true, :method => :post
|
||||
= link_to "Cancel hold", cancel_hold_organization_server_message_path(organization, @server, message.id), :class => "button button--small button--danger", :remote => true, :method => :post
|
||||
@@ -33,7 +33,7 @@
|
||||
%li.deliveryList__item
|
||||
.deliveryList__top
|
||||
.deliveryList__time
|
||||
= delivery.timestamp.to_s(:long)
|
||||
= delivery.timestamp.to_fs(:long)
|
||||
.deliveryList__status
|
||||
- if delivery.sent_with_ssl
|
||||
= image_tag 'icons/lock.svg', :class => 'deliveryList__secure'
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
%dd= message.mail_from || "none"
|
||||
|
||||
.messageList__meta
|
||||
%p.messageList__timestamp= message.timestamp.in_time_zone.to_s(:long)
|
||||
%p.messageList__timestamp= message.timestamp.in_time_zone.to_fs(:long)
|
||||
%p.messageList__status
|
||||
- if message.read?
|
||||
%span.label.label--purple Opened
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
= link_to @message.rcpt_to || "[blank]", send("#{@message.scope}_organization_server_messages_path", organization, @server, :query => "to: #{@message.rcpt_to}"), :class => 'u-link'
|
||||
%dl
|
||||
%dt Received
|
||||
%dd= @message.timestamp.in_time_zone.to_s(:long)
|
||||
%dd= @message.timestamp.in_time_zone.to_fs(:long)
|
||||
|
||||
.navBar.navBar--tertiary
|
||||
%ul
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- for entry in @entries.reverse
|
||||
- if entry.is_a?(Postal::MessageDB::Delivery)
|
||||
%li.messageActivity__event
|
||||
%p.messageActivity__timestamp= entry.timestamp.to_s(:long)
|
||||
%p.messageActivity__timestamp= entry.timestamp.to_fs(:long)
|
||||
.messageActivity__details.messageActivity--detailsDelivery
|
||||
%p.messageActivity__subject
|
||||
=# entry.status.underscore.humanize
|
||||
@@ -21,20 +21,20 @@
|
||||
|
||||
- elsif entry.is_a?(Postal::MessageDB::Click)
|
||||
%li.messageActivity__event
|
||||
%p.messageActivity__timestamp= entry.timestamp.to_s(:long)
|
||||
%p.messageActivity__timestamp= entry.timestamp.to_fs(:long)
|
||||
.messageActivity__details.messageActivity--detailsClick
|
||||
%p.messageActivity__subject Click for #{entry.url}
|
||||
%p.messageActivity__extra Clicked from #{entry.ip_address} (#{entry.user_agent})
|
||||
|
||||
- elsif entry.is_a?(Postal::MessageDB::Load)
|
||||
%li.messageActivity__event
|
||||
%p.messageActivity__timestamp= entry.timestamp.to_s(:long)
|
||||
%p.messageActivity__timestamp= entry.timestamp.to_fs(:long)
|
||||
.messageActivity__details.messageActivity--detailsLoad
|
||||
%p.messageActivity__subject Message Viewed
|
||||
%p.messageActivity__extra Opened from #{entry.ip_address} (#{entry.user_agent})
|
||||
|
||||
%li.messageActivity__event
|
||||
%p.messageActivity__timestamp= @message.timestamp.to_s(:long)
|
||||
%p.messageActivity__timestamp= @message.timestamp.to_fs(:long)
|
||||
.messageActivity__details
|
||||
%p.messageActivity__subject
|
||||
Message received by Postal
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
%p.suppressionList__address= link_to suppression['address'], outgoing_organization_server_messages_path(organization, @server, :query => "to: #{suppression['address']}")
|
||||
%p.suppressionList__reason= suppression['reason'].capitalize
|
||||
.suppressionList__right
|
||||
%p.suppressionList__timestamp Added #{Time.zone.at(suppression['timestamp']).to_s(:long)}
|
||||
%p.suppressionList__timestamp Added #{Time.zone.at(suppression['timestamp']).to_fs(:long)}
|
||||
%p.suppressionList__timestamp
|
||||
Expires #{Time.zone.at(suppression['keep_until']).to_s(:long)}
|
||||
Expires #{Time.zone.at(suppression['keep_until']).to_fs(:long)}
|
||||
- if suppression['keep_until'] < Time.now.to_f
|
||||
%span.u-red expired
|
||||
= render 'shared/message_db_pagination', :data => @suppressions, :name => "suppression"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
%li #{@first_date.strftime("%A at %l%P")} →
|
||||
%li Today at #{Time.now.strftime("%l%P")}
|
||||
- else
|
||||
%li #{@first_date.to_date.to_s(:long)} →
|
||||
%li #{@first_date.to_date.to_fs(:long)} →
|
||||
%li Today
|
||||
|
||||
.titleWithLinks.u-margin
|
||||
@@ -44,4 +44,3 @@
|
||||
%li= link_to "View message queue", [:queue, organization, @server], :class => 'titleWithLinks__link'
|
||||
%li= link_to "View full e-mail history", [:outgoing, organization, @server, :messages], :class => 'titleWithLinks__link'
|
||||
= render 'messages/list', :messages => @messages
|
||||
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم