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

This commit is contained in:
KMY 2025-01-23 18:10:34 +09:00
commit 50ae2d9439
320 changed files with 2587 additions and 2817 deletions

View file

@ -4,21 +4,9 @@ module Account::AttributionDomains
extend ActiveSupport::Concern
included do
validates :attribution_domains_as_text, domain: { multiline: true }, lines: { maximum: 100 }, if: -> { local? && will_save_change_to_attribution_domains? }
end
normalizes :attribution_domains, with: ->(arr) { arr.filter_map { |str| str.to_s.strip.delete_prefix('http://').delete_prefix('https://').delete_prefix('*.').presence }.uniq }
def attribution_domains_as_text
self[:attribution_domains].join("\n")
end
def attribution_domains_as_text=(str)
self[:attribution_domains] = str.split.filter_map do |line|
line
.strip
.delete_prefix('http://')
.delete_prefix('https://')
.delete_prefix('*.')
end
validates :attribution_domains, domain: true, length: { maximum: 100 }, if: -> { local? && will_save_change_to_attribution_domains? }
end
def can_be_attributed_from?(domain)

View file

@ -14,4 +14,6 @@ class CustomEmojiCategory < ApplicationRecord
has_many :emojis, class_name: 'CustomEmoji', foreign_key: 'category_id', inverse_of: :category, dependent: nil
validates :name, presence: true, uniqueness: true
scope :alphabetic, -> { order(name: :asc) }
end