Merge commit 'd730f6b0c5cfb18894d1a9e34d0aa2556dda3c62' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2025-12-11 18:05:28 +01:00
commit 53617cef5a
32 files changed
+450 -95

No files matched your search

+4
View File
@@ -451,6 +451,10 @@ class Account < ApplicationRecord
save!
end
def featureable?
local? && discoverable?
end
private
def prepare_contents
+10
View File
@@ -32,6 +32,8 @@ class CollectionItem < ApplicationRecord
validates :account, presence: true, if: :accepted?
validates :object_uri, presence: true, if: -> { account.nil? }
before_validation :set_position, on: :create
scope :ordered, -> { order(position: :asc) }
scope :with_accounts, -> { includes(account: [:account_stat, :user]) }
scope :not_blocked_by, ->(account) { where.not(accounts: { id: account.blocking }) }
@@ -39,4 +41,12 @@ class CollectionItem < ApplicationRecord
def local_item_with_remote_account?
local? && account&.remote?
end
private
def set_position
return if position_changed?
self.position = self.class.where(collection_id:).maximum(:position).to_i + 1
end
end