Merge remote-tracking branch 'parent/main' into kb_migration
This commit is contained in:
commit
e656ab15a1
21 changed files with 617 additions and 115 deletions
|
@ -67,6 +67,8 @@ class Account < ApplicationRecord
|
|||
trust_level
|
||||
)
|
||||
|
||||
BACKGROUND_REFRESH_INTERVAL = 1.week.freeze
|
||||
|
||||
USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i
|
||||
MENTION_RE = %r{(?<=^|[^/[:word:]])@((#{USERNAME_RE})(?:@[[:word:].-]+[[:word:]]+)?)}i
|
||||
URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
|
||||
|
@ -234,6 +236,12 @@ class Account < ApplicationRecord
|
|||
last_webfingered_at.nil? || last_webfingered_at <= 1.day.ago
|
||||
end
|
||||
|
||||
def schedule_refresh_if_stale!
|
||||
return unless last_webfingered_at.present? && last_webfingered_at <= BACKGROUND_REFRESH_INTERVAL.ago
|
||||
|
||||
AccountRefreshWorker.perform_in(rand(6.hours.to_i), id)
|
||||
end
|
||||
|
||||
def refresh!
|
||||
ResolveAccountService.new.call(acct) unless local?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue