From 061feb63ed852acb5d70e2678c9e63425e6ca71b Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 21 Jan 2019 20:03:04 +0100 Subject: Fix scheduled toot with media immediately creating a toot (#9894) * Add test for not persisting status when attaching media to scheduled toot * Prevent status used for validation from being persisted to the database Fixes #9893 Thanks to tateisu for the help investigating this. --- app/services/post_status_service.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/services') diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index cc3453f99..1f5a3f4cf 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -66,7 +66,10 @@ class PostStatusService < BaseService end def schedule_status! - if @account.statuses.build(status_attributes).valid? + status_for_validation = @account.statuses.build(status_attributes) + if status_for_validation.valid? + status_for_validation.destroy + # The following transaction block is needed to wrap the UPDATEs to # the media attachments when the scheduled status is created -- cgit From e1ec3a9f09add8a34b1a77ce217be8e51ebd4936 Mon Sep 17 00:00:00 2001 From: "Renato \"Lond\" Cerqueira" Date: Thu, 24 Jan 2019 15:38:18 +0100 Subject: Rescue SSL error in verify link service (#9914) If the first link to be verified contains a rel=me link with a SSL error, the VerifyAccountLinksWorker will fail and not try the following links. This rescues the SSL error when fetching the link, avoiding this issue. --- app/services/verify_link_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/services') diff --git a/app/services/verify_link_service.rb b/app/services/verify_link_service.rb index c65578761..878a2188d 100644 --- a/app/services/verify_link_service.rb +++ b/app/services/verify_link_service.rb @@ -10,7 +10,7 @@ class VerifyLinkService < BaseService return unless link_back_present? field.mark_verified! - rescue HTTP::Error, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e + rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e Rails.logger.debug "Error fetching link #{@url}: #{e}" nil end -- cgit