1
0
Fork 0
forked from gitea/nas

Merge remote-tracking branch 'parent/main' into upstream-20240417

This commit is contained in:
KMY 2024-04-17 12:51:32 +09:00
commit 51cf7b3eb4
76 changed files with 835 additions and 307 deletions

View file

@ -68,6 +68,7 @@ class Account < ApplicationRecord
)
BACKGROUND_REFRESH_INTERVAL = 1.week.freeze
DEFAULT_FIELDS_SIZE = 6
INSTANCE_ACTOR_ID = -99
USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i
@ -110,7 +111,7 @@ class Account < ApplicationRecord
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? }
validates :note, note_length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? }
validates :fields, length: { maximum: 6 }, if: -> { local? && will_save_change_to_fields? }
validates :fields, length: { maximum: DEFAULT_FIELDS_SIZE }, if: -> { local? && will_save_change_to_fields? }
validates :uri, absence: true, if: :local?, on: :create
validates :inbox_url, absence: true, if: :local?, on: :create
validates :shared_inbox_url, absence: true, if: :local?, on: :create
@ -410,8 +411,6 @@ class Account < ApplicationRecord
self[:fields] = fields
end
DEFAULT_FIELDS_SIZE = 6
def build_fields
return if fields.size >= DEFAULT_FIELDS_SIZE