diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 9 | ||||
-rw-r--r-- | app/models/user.rb | 16 |
2 files changed, 11 insertions, 14 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 62f9e5831..9eaf85668 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -160,6 +160,15 @@ class Status < ApplicationRecord ids.uniq end + def searchable_text + [ + spoiler_text, + FormattingHelper.extract_status_plain_text(self), + preloadable_poll ? preloadable_poll.options.join("\n\n") : nil, + ordered_media_attachments.map(&:description).join("\n\n"), + ].compact.join("\n\n") + end + def reply? !in_reply_to_id.nil? || attributes['reply'] end diff --git a/app/models/user.rb b/app/models/user.rb index 76ad7d1b2..5dd93519c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,6 +47,7 @@ class User < ApplicationRecord remember_token current_sign_in_ip last_sign_in_ip + skip_sign_in_token ) include Settings::Extend @@ -132,7 +133,7 @@ class User < ApplicationRecord :disable_swiping, :default_content_type, :system_emoji_font, to: :settings, prefix: :setting, allow_nil: false - attr_reader :invite_code, :sign_in_token_attempt + attr_reader :invite_code attr_writer :external, :bypass_invite_request_check def confirmed? @@ -200,10 +201,6 @@ class User < ApplicationRecord !account.memorial? end - def suspicious_sign_in?(ip) - !otp_required_for_login? && !skip_sign_in_token? && current_sign_in_at.present? && !ips.where(ip: ip).exists? - end - def functional? confirmed? && approved? && !disabled? && !account.suspended? && !account.memorial? end @@ -376,15 +373,6 @@ class User < ApplicationRecord setting_display_media == 'hide_all' end - def sign_in_token_expired? - sign_in_token_sent_at.nil? || sign_in_token_sent_at < 5.minutes.ago - end - - def generate_sign_in_token - self.sign_in_token = Devise.friendly_token(6) - self.sign_in_token_sent_at = Time.now.utc - end - protected def send_devise_notification(notification, *args, **kwargs) |