mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 17:38:07 +01:00
d5c9feb7b7
* Add support for private pinned toots * Allow local user to pin private toots * Change wording to avoid "direct message"
10 lines
526 B
Ruby
10 lines
526 B
Ruby
# frozen_string_literal: true
|
|
|
|
class StatusPinValidator < ActiveModel::Validator
|
|
def validate(pin)
|
|
pin.errors.add(:base, I18n.t('statuses.pin_errors.reblog')) if pin.status.reblog?
|
|
pin.errors.add(:base, I18n.t('statuses.pin_errors.ownership')) if pin.account_id != pin.status.account_id
|
|
pin.errors.add(:base, I18n.t('statuses.pin_errors.direct')) if pin.status.direct_visibility?
|
|
pin.errors.add(:base, I18n.t('statuses.pin_errors.limit')) if pin.account.status_pins.count > 4 && pin.account.local?
|
|
end
|
|
end
|