diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/notification.rb | 8 | ||||
-rw-r--r-- | app/models/user.rb | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb index 62c68dfb1..1e64d1ae9 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -48,10 +48,6 @@ class Notification < ApplicationRecord cache_associated :from_account, status: STATUS_INCLUDES, mention: [status: STATUS_INCLUDES], favourite: [:account, status: STATUS_INCLUDES], follow: :account - def activity(eager_loaded = true) - eager_loaded ? send(activity_type.underscore) : super() - end - def type @type ||= TYPE_CLASS_MAP.invert[activity_type].to_sym end @@ -96,9 +92,9 @@ class Notification < ApplicationRecord case activity_type when 'Status', 'Follow', 'Favourite', 'FollowRequest' - self.from_account_id = activity(false)&.account_id + self.from_account_id = activity&.account_id when 'Mention' - self.from_account_id = activity(false)&.status&.account_id + self.from_account_id = activity&.status&.account_id end end end diff --git a/app/models/user.rb b/app/models/user.rb index 8840de82d..c0600fe75 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -58,6 +58,11 @@ class User < ApplicationRecord before_validation :sanitize_languages + # This avoids a deprecation warning from Rails 5.1 + # It seems possible that a future release of devise-two-factor will + # handle this itself, and this can be removed from our User class. + attribute :otp_secret + def confirmed? confirmed_at.present? end |