Browse Source

Fix change of status callbacks not setting in_reply_to_account_id and (#3072)

possibly others when expected. Add some tests for it
closed-social-glitch-2
Eugen Rochko 7 years ago
committed by GitHub
parent
commit
af706583bd
2 changed files with 14 additions and 4 deletions
  1. +4
    -4
      app/models/status.rb
  2. +10
    -0
      spec/services/process_feed_service_spec.rb

+ 4
- 4
app/models/status.rb View File

@ -72,7 +72,7 @@ class Status < ApplicationRecord
cache_associated :account, :application, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :application, :stream_entry, :tags, :media_attachments, mentions: :account], thread: :account
def reply?
!in_reply_to_id.nil? || super
!in_reply_to_id.nil? || attributes['reply']
end
def local?
@ -144,9 +144,9 @@ class Status < ApplicationRecord
end
before_validation :prepare_contents
before_create :set_reblog
before_create :set_visibility
before_create :set_conversation
before_validation :set_reblog
before_validation :set_visibility
before_validation :set_conversation
class << self
def in_allowed_languages(account)

+ 10
- 0
spec/services/process_feed_service_spec.rb View File

@ -31,6 +31,16 @@ RSpec.describe ProcessFeedService do
expect(Status.find_by(uri: 'tag:kickass.zone,2016-10-10:objectId=2:objectType=Status')).to_not be_nil
end
it 'marks replies as replies' do
status = Status.find_by(uri: 'tag:kickass.zone,2016-10-10:objectId=2:objectType=Status')
expect(status.reply?).to be true
end
it 'sets account being replied to when possible' do
status = Status.find_by(uri: 'tag:kickass.zone,2016-10-10:objectId=2:objectType=Status')
expect(status.in_reply_to_account_id).to eq status.account_id
end
it 'ignores delete statuses unless they existed before' do
expect(Status.find_by(uri: 'tag:kickass.zone,2016-10-10:objectId=3:objectType=Status')).to be_nil
expect(Status.find_by(uri: 'tag:kickass.zone,2016-10-10:objectId=12:objectType=Status')).to be_nil

Loading…
Cancel
Save