Don't forget to lycansubscribe

added some helpers in AT_URI

Changed files
+11 -1
app
+10
app/at_uri.rb
··· 2 2 class InvalidURIError 3 3 end 4 4 5 + TID_PATTERN = /^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/ 6 + 5 7 attr_reader :repo, :collection, :rkey 6 8 7 9 def initialize(uri) ··· 24 26 25 27 def to_s 26 28 @uri 29 + end 30 + 31 + def has_valid_tid? 32 + @rkey =~ TID_PATTERN 33 + end 34 + 35 + def is_post? 36 + @collection == 'app.bsky.feed.post' && has_valid_tid? 27 37 end 28 38 end 29 39
+1 -1
app/importers/base_importer.rb
··· 48 48 49 49 def create_item_for_post(uri) 50 50 post_uri = AT_URI(uri) 51 - return if post_uri.collection != 'app.bsky.feed.post' || post_uri.rkey.length != 13 51 + return unless post_uri.is_post? 52 52 53 53 post = Post.find_by( 54 54 user_id: user_id_for_did(post_uri.repo),