show reply / quotes for bsky posts

This commit is contained in:
Dylan Knutson
2025-08-12 18:31:17 +00:00
parent 127dd9be51
commit d08c896d97
5 changed files with 164 additions and 0 deletions

View File

@@ -4,6 +4,32 @@ class Domain::Post::BlueskyPost < Domain::Post
belongs_to :first_seen_entry, class_name: "::HttpLogEntry", optional: true
belongs_to :quoted_post,
class_name: "Domain::Post::BlueskyPost",
optional: true,
foreign_key: :quote_uri,
primary_key: :at_uri,
inverse_of: :quoting_posts
has_many :quoting_posts,
class_name: "Domain::Post::BlueskyPost",
foreign_key: :quote_uri,
primary_key: :at_uri,
inverse_of: :quoted_post
belongs_to :replying_to_post,
class_name: "Domain::Post::BlueskyPost",
optional: true,
foreign_key: :reply_to_uri,
primary_key: :at_uri,
inverse_of: :replying_posts
has_many :replying_posts,
class_name: "Domain::Post::BlueskyPost",
foreign_key: :reply_to_uri,
primary_key: :at_uri,
inverse_of: :replying_to_post
has_multiple_files! Domain::PostFile::BlueskyPostFile
has_single_creator! Domain::User::BlueskyUser
has_faving_users! Domain::User::BlueskyUser
@@ -56,6 +82,11 @@ class Domain::Post::BlueskyPost < Domain::Post
self.rkey
end
sig { override.returns(T.nilable(String)) }
def primary_creator_name_fallback_for_view
self.creator&.handle
end
sig { override.returns(T.nilable(Addressable::URI)) }
def external_url_for_view
handle = self.creator&.handle

View File

@@ -0,0 +1,27 @@
<% post = T.cast(post, Domain::Post::BlueskyPost) %>
<% if (quoted_post = post.quoted_post) %>
<span class="flex items-center">
<i class="fa-solid fa-quote-left mr-1"></i>
<%= render(
"domain/has_description_html/inline_link_domain_post",
post: quoted_post,
visual_style: "sky-link",
domain_icon: false,
link_text: "Quoted by #{post.primary_creator_name_fallback_for_view}"
)
%>
</span>
<% end %>
<% if (replying_to_post = post.replying_to_post) %>
<span class="flex items-center">
<i class="fa-solid fa-reply mr-1"></i>
<%= render(
"domain/has_description_html/inline_link_domain_post",
post: replying_to_post,
visual_style: "sky-link",
domain_icon: false,
link_text: "Replied to #{post.primary_creator_name_fallback_for_view}"
)
%>
</span>
<% end %>