about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-01-19 15:22:10 -0600
committerDavid Yip <yipdw@member.fsf.org>2018-01-19 15:22:10 -0600
commit2ca965c704075467226dbf798e13ac8e0e62cc15 (patch)
treec437e1f4993a6337759eb09157c78cd8134fd774 /app/models/status.rb
parent2b2de41bc7ecec15aa73650da153e50f0e16f16b (diff)
parent0b888acfd4ffddd29f25c878373e9b9f5ec6c0ab (diff)
Merge remote-tracking branch 'origin/master' into merge-upstream
 Conflicts:
	app/javascript/styles/mastodon/components.scss
	app/javascript/styles/mastodon/modal.scss
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index cb18b0705..e927fb9dd 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -34,14 +34,14 @@ class Status < ApplicationRecord
 
   enum visibility: [:public, :unlisted, :private, :direct], _suffix: :visibility
 
-  belongs_to :application, class_name: 'Doorkeeper::Application'
+  belongs_to :application, class_name: 'Doorkeeper::Application', optional: true
 
-  belongs_to :account, inverse_of: :statuses, counter_cache: true, required: true
-  belongs_to :in_reply_to_account, foreign_key: 'in_reply_to_account_id', class_name: 'Account'
-  belongs_to :conversation
+  belongs_to :account, inverse_of: :statuses, counter_cache: true
+  belongs_to :in_reply_to_account, foreign_key: 'in_reply_to_account_id', class_name: 'Account', optional: true
+  belongs_to :conversation, optional: true
 
-  belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies
-  belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblogs, counter_cache: :reblogs_count
+  belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies, optional: true
+  belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblogs, counter_cache: :reblogs_count, optional: true
 
   has_many :favourites, inverse_of: :status, dependent: :destroy
   has_many :reblogs, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblog, dependent: :destroy