mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-29 02:50:46 +00:00
Rename column
`remote_items` was nice and short but could be misunderstood as "how many items are accounts from other servers". This should make it clear that this is the number of items for remote collections that could in theory exceed Mastodon's limit.
This commit is contained in:
parent
899fb4816b
commit
b4cfb60a4d
|
|
@ -4,18 +4,18 @@
|
|||
#
|
||||
# Table name: collections
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# description :text not null
|
||||
# discoverable :boolean not null
|
||||
# local :boolean not null
|
||||
# name :string not null
|
||||
# remote_items :integer
|
||||
# sensitive :boolean not null
|
||||
# uri :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint(8) not null
|
||||
# tag_id :bigint(8)
|
||||
# id :bigint(8) not null, primary key
|
||||
# description :text not null
|
||||
# discoverable :boolean not null
|
||||
# local :boolean not null
|
||||
# name :string not null
|
||||
# original_number_of_items :integer
|
||||
# sensitive :boolean not null
|
||||
# uri :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint(8) not null
|
||||
# tag_id :bigint(8)
|
||||
#
|
||||
class Collection < ApplicationRecord
|
||||
MAX_ITEMS = 25
|
||||
|
|
@ -28,9 +28,10 @@ class Collection < ApplicationRecord
|
|||
validates :name, presence: true
|
||||
validates :description, presence: true
|
||||
validates :uri, presence: true, if: :remote?
|
||||
validates :remote_items, presence: true,
|
||||
numericality: { greater_than_or_equal: 0 },
|
||||
if: :remote?
|
||||
validates :original_number_of_items,
|
||||
presence: true,
|
||||
numericality: { greater_than_or_equal: 0 },
|
||||
if: :remote?
|
||||
validate :tag_is_usable
|
||||
validate :items_do_not_exceed_limit
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class CreateCollections < ActiveRecord::Migration[8.0]
|
|||
t.boolean :sensitive, null: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
t.boolean :discoverable, null: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
t.references :tag, foreign_key: true
|
||||
t.integer :remote_items
|
||||
t.integer :original_number_of_items
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_19_093332) do
|
|||
t.boolean "sensitive", null: false
|
||||
t.boolean "discoverable", null: false
|
||||
t.bigint "tag_id"
|
||||
t.integer "remote_items"
|
||||
t.integer "original_number_of_items"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_collections_on_account_id"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ RSpec.describe Collection do
|
|||
|
||||
it { is_expected.to validate_presence_of(:uri) }
|
||||
|
||||
it { is_expected.to validate_presence_of(:remote_items) }
|
||||
it { is_expected.to validate_presence_of(:original_number_of_items) }
|
||||
end
|
||||
|
||||
context 'when using a hashtag as category' do
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user