- Add BlueskyPostHelper for rendering Bluesky post facets (mentions, links, hashtags) - Implement facet parsing and rendering with proper styling - Add external link partial for non-Bluesky URLs - Update DisplayedFile and PostFiles components to handle Bluesky posts - Add comprehensive test coverage for helper methods - Update scan user job to handle Bluesky-specific data
23 lines
571 B
Ruby
23 lines
571 B
Ruby
# typed: strict
|
|
# frozen_string_literal: true
|
|
|
|
class Bluesky::Text::Facet < T::ImmutableStruct
|
|
extend T::Sig
|
|
|
|
const :byteStart, Integer
|
|
const :byteEnd, Integer
|
|
const :features, T::Array[Bluesky::Text::FacetFeature]
|
|
|
|
sig { params(hash: T::Hash[String, T.untyped]).returns(Bluesky::Text::Facet) }
|
|
def self.from_hash(hash)
|
|
new(
|
|
byteStart: hash["index"]["byteStart"],
|
|
byteEnd: hash["index"]["byteEnd"],
|
|
features:
|
|
hash["features"].map do |feature|
|
|
Bluesky::Text::FacetFeature.from_hash(feature)
|
|
end,
|
|
)
|
|
end
|
|
end
|