Fix error when scheduled_at attribute is malformed (#9866)

This commit is contained in:
Eugen Rochko 2019-01-19 22:01:01 +01:00 committed by GitHub
parent 7c3fddeab4
commit 6ca9015789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,8 @@ class PostStatusService < BaseService
@visibility = :unlisted if @visibility == :public && @account.silenced @visibility = :unlisted if @visibility == :public && @account.silenced
@scheduled_at = @options[:scheduled_at]&.to_datetime @scheduled_at = @options[:scheduled_at]&.to_datetime
@scheduled_at = nil if scheduled_in_the_past? @scheduled_at = nil if scheduled_in_the_past?
rescue ArgumentError
raise ActiveRecord::RecordInvalid
end end
def process_status! def process_status!