user avatar typing

This commit is contained in:
Dylan Knutson
2025-01-27 04:59:25 +00:00
parent ade1d478a5
commit 414b56ab69

View File

@@ -1,4 +1,4 @@
# typed: false
# typed: true
class Domain::Fa::UserAvatar < ReduxApplicationRecord
self.table_name = "domain_fa_user_avatars"
@@ -22,7 +22,10 @@ class Domain::Fa::UserAvatar < ReduxApplicationRecord
belongs_to :log_entry, class_name: "::HttpLogEntry", optional: true
def file
@file_model ||= BlobEntry.ensure(file_sha256) if file_sha256
@file_model ||=
if (file_sha256 = self.file_sha256)
BlobEntry.ensure(file_sha256)
end
end
def file_uri
@@ -36,7 +39,7 @@ class Domain::Fa::UserAvatar < ReduxApplicationRecord
end
def guess_user_page_log_entry
user.guess_user_page_log_entry
user&.guess_user_page_log_entry
end
def guess_file_uri_from_hles_with_info
@@ -52,6 +55,9 @@ class Domain::Fa::UserAvatar < ReduxApplicationRecord
end
end
user = self.user
return nil unless user
posts =
user
.posts
@@ -62,10 +68,10 @@ class Domain::Fa::UserAvatar < ReduxApplicationRecord
for post in posts
if (hle = post.guess_last_submission_page)
page = Domain::Fa::Parser::Page.new(hle.response.contents)
page = Domain::Fa::Parser::Page.new(T.must(hle.response&.contents))
next unless page.probably_submission?
url = page.submission.artist_avatar_url
return :post_page, url, post.fa_id if url
avatar_url = page.submission.artist_avatar_url
return :post_page, avatar_url, post.fa_id if avatar_url
end
end