Merge tag 'v1.6.0rc3' into sync/upstream

This commit is contained in:
David Yip
2017-09-09 14:28:08 -05:00
87 changed files with 947 additions and 285 deletions

View File

@@ -22,6 +22,7 @@
# reblogs_count :integer default(0), not null
# language :string
# conversation_id :integer
# local :boolean
#
class Status < ApplicationRecord
@@ -84,7 +85,7 @@ class Status < ApplicationRecord
end
def local?
uri.nil?
attributes['local'] || uri.nil?
end
def reblog?
@@ -131,11 +132,14 @@ class Status < ApplicationRecord
!sensitive? && media_attachments.any?
end
after_create :store_uri, if: :local?
before_validation :prepare_contents, if: :local?
before_validation :set_reblog
before_validation :set_visibility
before_validation :set_conversation
before_validation :set_sensitivity
before_validation :set_local
class << self
def not_in_filtered_languages(account)
@@ -253,6 +257,10 @@ class Status < ApplicationRecord
private
def store_uri
update_attribute(:uri, ActivityPub::TagManager.instance.uri_for(self)) if uri.nil?
end
def prepare_contents
text&.strip!
spoiler_text&.strip!
@@ -292,4 +300,8 @@ class Status < ApplicationRecord
thread.account_id
end
end
def set_local
self.local = account.local?
end
end