]> cat aescling's git repositories - mastodon.git/commitdiff
Remove dependency on running Redis server for db:setup (#18560)
authorClaire <claire.github-309c@sitedethib.com>
Wed, 1 Jun 2022 17:23:31 +0000 (19:23 +0200)
committeraescling <aescling+gitlab@cat.family>
Mon, 5 Sep 2022 04:27:49 +0000 (00:27 -0400)
app/models/account.rb
lib/paperclip/attachment_extensions.rb

index 7c81e07d9d61a8f754e94f5062cb6d8e3913cb02..d7f0aced93d5f89362af9681fff6a8ffd7b9cc59 100644 (file)
@@ -92,7 +92,7 @@ class Account < ApplicationRecord
 
   # Local user validations
   validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
-  validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? }
+  validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? will_save_change_to_username? && actor_type != 'Application' }
   validates :display_name, length: { maximum: MAX_DISPLAY_NAME_LENGTH }, if: -> { local? && will_save_change_to_display_name? }
   validates :note, note_length: { maximum: MAX_NOTE_LENGTH }, if: -> { local? && will_save_change_to_note? }
   validates :fields, length: { maximum: DEFAULT_FIELDS_SIZE }, if: -> { local? && will_save_change_to_fields? }
index 786f558e9b9ca44a72e0adda63bffce3d9198501..d66a176235bece272056a3ad219854fdefc29a4c 100644 (file)
@@ -81,6 +81,9 @@ module Paperclip
     # to respond or don't respond at all and as such minimize the
     # impact of object storage outages on application throughput
     def save
+      # Don't go through Stoplight if we don't have anything object-storage-oriented to do
+      return super if @queued_for_delete.empty? && @queued_for_write.empty? && !dirty?
+
       Stoplight('object-storage') { super }.with_threshold(STOPLIGHT_THRESHOLD).with_cool_off_time(STOPLIGHT_COOLDOWN).with_error_handler do |error, handle|
         if error.is_a?(Seahorse::Client::NetworkingError)
           handle.call(error)