diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 2 | ||||
-rw-r--r-- | app/models/status.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 25316c9a4..16db2d719 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -6,7 +6,7 @@ class Account < ApplicationRecord # Local users has_one :user, inverse_of: :account - validates :username, presence: true, format: { with: /\A[a-z0-9_]+\z/i, message: 'only letters, numbers and underscores' }, uniqueness: { scope: :domain, case_sensitive: false }, if: 'local?' + validates :username, presence: true, format: { with: /\A[a-z0-9_]+\z/i, message: 'only letters, numbers and underscores' }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: 'local?' validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: true }, unless: 'local?' # Avatar upload diff --git a/app/models/status.rb b/app/models/status.rb index ae5c4b496..cbcde69f4 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -15,7 +15,7 @@ class Status < ApplicationRecord validates :account, presence: true validates :uri, uniqueness: true, unless: 'local?' - validates :text, presence: true, if: Proc.new { |s| s.local? && !s.reblog? } + validates :text, presence: true, length: { maximum: 500 }, if: Proc.new { |s| s.local? && !s.reblog? } scope :with_counters, -> { select('statuses.*, (select count(r.id) from statuses as r where r.reblog_of_id = statuses.id) as reblogs_count, (select count(f.id) from favourites as f where f.status_id = statuses.id) as favourites_count') } scope :with_includes, -> { includes(:account, :media_attachments, :stream_entry, mentions: :account, reblog: [:account, mentions: :account], thread: :account) } |