Merge 2.7.3 #8

Merged
chr merged 70 commits from upstream_v2.7.3 into cybrespace 2019-02-24 01:55:42 +01:00
2 changed files with 18 additions and 1 deletions
Showing only changes of commit 061feb63ed - Show all commits

View File

@ -66,7 +66,10 @@ class PostStatusService < BaseService
end end
def schedule_status! 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 following transaction block is needed to wrap the UPDATEs to
# the media attachments when the scheduled status is created # the media attachments when the scheduled status is created

View File

@ -36,6 +36,20 @@ RSpec.describe PostStatusService, type: :service do
expect(status.params['text']).to eq 'Hi future!' expect(status.params['text']).to eq 'Hi future!'
end end
it 'does not immediately create a status when scheduling a status' do
account = Fabricate(:account)
media = Fabricate(:media_attachment)
future = Time.now.utc + 2.hours
status = subject.call(account, text: 'Hi future!', media_ids: [media.id], scheduled_at: future)
expect(status).to be_a ScheduledStatus
expect(status.scheduled_at).to eq future
expect(status.params['text']).to eq 'Hi future!'
expect(media.reload.status).to be_nil
expect(Status.where(text: 'Hi future!').exists?).to be_falsey
end
it 'creates response to the original status of boost' do it 'creates response to the original status of boost' do
boosted_status = Fabricate(:status) boosted_status = Fabricate(:status)
in_reply_to_status = Fabricate(:status, reblog: boosted_status) in_reply_to_status = Fabricate(:status, reblog: boosted_status)