Fa::User: name_to_url_name fixes, generalize timestamp checking
This commit is contained in:
@@ -86,15 +86,15 @@ class Domain::Fa::User < ReduxApplicationRecord
|
||||
end
|
||||
|
||||
def due_for_page_scan?
|
||||
scanned_page_at.nil? || scanned_page_at < 1.month.ago
|
||||
timestamp_due?(scanned_page_at, 1.month)
|
||||
end
|
||||
|
||||
def due_for_gallery_scan?
|
||||
scanned_gallery_at.nil? || scanned_gallery_at < 1.year.ago
|
||||
timestamp_due?(scanned_gallery_at, 1.year)
|
||||
end
|
||||
|
||||
def due_for_follows_scan?
|
||||
scanned_follows_at.nil? || scanned_follows_at < 1.month.ago
|
||||
timestamp_due?(scanned_follows_at, 1.month)
|
||||
end
|
||||
|
||||
def self.find_or_build_from_legacy(legacy_user)
|
||||
@@ -140,7 +140,13 @@ class Domain::Fa::User < ReduxApplicationRecord
|
||||
end
|
||||
|
||||
def self.name_to_url_name(name)
|
||||
name.delete("_").delete("!").delete("∞").downcase
|
||||
name.
|
||||
delete_prefix("-").
|
||||
delete("_").
|
||||
delete("!").
|
||||
delete("∞").
|
||||
downcase.
|
||||
strip
|
||||
end
|
||||
|
||||
# TODO - write method for getting suggested users to follow
|
||||
@@ -184,4 +190,8 @@ class Domain::Fa::User < ReduxApplicationRecord
|
||||
joins(:disco).
|
||||
merge(disco_query.reselect(:user_id))
|
||||
end
|
||||
|
||||
def timestamp_due?(timestamp, duration)
|
||||
timestamp.nil? || timestamp < duration.ago
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user