about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-02-10 22:08:45 -0600
committerDavid Yip <yipdw@member.fsf.org>2018-02-10 22:08:45 -0600
commitb6159bcb0a20f3aabfb4d17ad60842b7aa81925c (patch)
tree5fbc5ebb3890ddbf0399bc1fd448f109561b2771 /app/models
parent136458eaf4f73abc5bcb5d0b0978aff892e92f27 (diff)
parentb8efc3fc0b961d356472cf2e56fde69a6589ffaa (diff)
Merge remote-tracking branch 'origin/merge-upstream'
Diffstat (limited to 'app/models')
-rw-r--r--app/models/invite.rb2
-rw-r--r--app/models/notification.rb3
-rw-r--r--app/models/user.rb2
-rw-r--r--app/models/web/setting.rb2
4 files changed, 5 insertions, 4 deletions
diff --git a/app/models/invite.rb b/app/models/invite.rb
index b87a3b722..4ba5432d2 100644
--- a/app/models/invite.rb
+++ b/app/models/invite.rb
@@ -4,7 +4,7 @@
 # Table name: invites
 #
 #  id         :integer          not null, primary key
-#  user_id    :integer
+#  user_id    :integer          not null
 #  code       :string           default(""), not null
 #  expires_at :datetime
 #  max_uses   :integer
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 733f89cf7..7f8dae5ec 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -69,7 +69,7 @@ class Notification < ApplicationRecord
 
   class << self
     def reload_stale_associations!(cached_items)
-      account_ids = cached_items.map(&:from_account_id).uniq
+      account_ids = (cached_items.map(&:from_account_id) + cached_items.map { |item| item.target_status&.account_id }.compact).uniq
 
       return if account_ids.empty?
 
@@ -77,6 +77,7 @@ class Notification < ApplicationRecord
 
       cached_items.each do |item|
         item.from_account = accounts[item.from_account_id]
+        item.target_status.account = accounts[item.target_status.account_id] if item.target_status
       end
     end
 
diff --git a/app/models/user.rb b/app/models/user.rb
index d495fc390..af54efded 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -84,7 +84,7 @@ class User < ApplicationRecord
   has_many :session_activations, dependent: :destroy
 
   delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
-           :reduce_motion, :system_font_ui, :noindex, :flavour, :skin,
+           :reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_sensitive_media,
            to: :settings, prefix: :setting, allow_nil: false
 
   attr_accessor :invite_code
diff --git a/app/models/web/setting.rb b/app/models/web/setting.rb
index 12b9d1226..0a5129d17 100644
--- a/app/models/web/setting.rb
+++ b/app/models/web/setting.rb
@@ -7,7 +7,7 @@
 #  data       :json
 #  created_at :datetime         not null
 #  updated_at :datetime         not null
-#  user_id    :integer
+#  user_id    :integer          not null
 #
 
 class Web::Setting < ApplicationRecord