Add replies to posts

This commit is contained in:
2024-03-22 08:48:21 +11:00
parent 6a5ff26948
commit a2c11de10f
12 changed files with 55 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ module Micropub
decorated_post = Decorators::Posts::Decorator.new(created_post)
send_webmentions.call(post_content: created_post.content, post_url: decorated_post.permalink)
send_webmentions.call(post_content: created_post.content, post_url: decorated_post.permalink, in_reply_to: created_post.in_reply_to)
Success(created_post)
end

View File

@@ -7,10 +7,10 @@ module Micropub
class SendWebmentions
include Deps["settings", "post_utilities.link_finder"]
def call(post_content:, post_url:)
def call(post_content:, post_url:, in_reply_to:)
Que.connection = Adamantium::Container["persistence.db"]
Adamantium::Jobs::SendWebMentions.enqueue(post_content: post_content, post_url: post_url)
Adamantium::Jobs::SendWebMentions.enqueue(post_content: post_content, post_url: post_url, in_reply_to: in_reply_to)
end
end
end

View File

@@ -10,6 +10,7 @@ module Micropub
attribute :published_at, Types::Nominal::DateTime.optional
attribute :post_type, Types::Coercible::String
attribute :syndicate_to, Types::Array.of(Types::Coercible::String)
attribute :in_reply_to, Types::Coercible::String
attribute :photos, Types::Array.of(Types::Hash)
attribute :location, Types::Coercible::String.optional
end

View File

@@ -97,6 +97,7 @@ module Micropub
content: content,
slug: params[:slug] || params[:"mp-slug"],
syndicate_to: Array(params[:properties][:"mp-syndicate-to"]) || [],
in_reply_to: params[:properties][:"in-reply-to"] || nil,
photos: photos,
location: params[:properties][:location]
})
@@ -119,6 +120,7 @@ module Micropub
new_params.merge({
syndicate_to: Array(params[:"mp-syndicate-to"]) || [],
in_reply_to: params[:"in-reply-to"],
name: params[:name],
slug: params[:slug] || params[:"mp-slug"],
published_at: (params[:"post-status"] == "draft") ? nil : publish_time,

View File

@@ -12,6 +12,7 @@ module Micropub
required(:syndicate_to).array(:string)
required(:photos).array(:hash)
required(:location).maybe(:string)
required(:in_reply_to).maybe(:string)
end
end
end