Convert OStatus tag to ActivityPub id on in_reply_to resolution (#4756)

This commit is contained in:
unarist 2017-09-01 20:34:04 +09:00 committed by Eugen Rochko
parent af2d22f88c
commit 504737e860
2 changed files with 11 additions and 1 deletions

View File

@ -56,6 +56,16 @@ class OStatus::Activity::Base
Status.find_by(uri: uri) Status.find_by(uri: uri)
end end
def find_activitypub_status(uri, href)
tag_matches = /tag:([^,:]+)[^:]*:objectId=([\d]+)/.match(uri)
href_matches = %r{/users/([^/]+)}.match(href)
unless tag_matches.nil? || href_matches.nil?
uri = "https://#{tag_matches[1]}/users/#{href_matches[1]}/statuses/#{tag_matches[2]}"
Status.find_by(uri: uri)
end
end
def redis def redis
Redis.current Redis.current
end end

View File

@ -36,7 +36,7 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
language: content_language, language: content_language,
visibility: visibility_scope, visibility: visibility_scope,
conversation: find_or_create_conversation, conversation: find_or_create_conversation,
thread: thread? ? find_status(thread.first) : nil thread: thread? ? find_status(thread.first) || find_activitypub_status(thread.first, thread.second) : nil
) )
save_mentions(status) save_mentions(status)