mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-12 21:17:11 +01:00
Use shorter attribute query methods in Announcement
(#28474)
This commit is contained in:
parent
fd57e40681
commit
ba5f659bb3
@ -28,8 +28,8 @@ class Announcement < ApplicationRecord
|
|||||||
has_many :announcement_reactions, dependent: :destroy
|
has_many :announcement_reactions, dependent: :destroy
|
||||||
|
|
||||||
validates :text, presence: true
|
validates :text, presence: true
|
||||||
validates :starts_at, presence: true, if: -> { ends_at.present? }
|
validates :starts_at, presence: true, if: :ends_at?
|
||||||
validates :ends_at, presence: true, if: -> { starts_at.present? }
|
validates :ends_at, presence: true, if: :starts_at?
|
||||||
|
|
||||||
before_validation :set_published, on: :create
|
before_validation :set_published, on: :create
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class Announcement < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def time_range?
|
def time_range?
|
||||||
starts_at.present? && ends_at.present?
|
starts_at? && ends_at?
|
||||||
end
|
end
|
||||||
|
|
||||||
def mentions
|
def mentions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user