From 377195c8d30cd7cdc9c1ac93c50accb768846bf5 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sun, 29 Jan 2023 12:41:10 +1100 Subject: [PATCH] Fix contracts --- app/commands/posts/syndicate.rb | 2 +- app/validation/posts/bookmark_contract.rb | 1 + app/validation/posts/post_contract.rb | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/commands/posts/syndicate.rb b/app/commands/posts/syndicate.rb index 259edd0..97e4800 100644 --- a/app/commands/posts/syndicate.rb +++ b/app/commands/posts/syndicate.rb @@ -5,7 +5,7 @@ module Adamantium include Deps["settings", "syndication.mastodon"] def call(post) - if post.syndicate_to.include settings.mastodon_server + if post[:syndicate_to].include settings.mastodon_server mastodon.call(post: post) end end diff --git a/app/validation/posts/bookmark_contract.rb b/app/validation/posts/bookmark_contract.rb index d5c8b84..8ced50b 100644 --- a/app/validation/posts/bookmark_contract.rb +++ b/app/validation/posts/bookmark_contract.rb @@ -10,6 +10,7 @@ module Adamantium required(:url).filled(:string) required(:slug).filled(:string) required(:post_type).value(included_in?: %w[bookmark]) + required(:syndicate_to).array(:string) end end end diff --git a/app/validation/posts/post_contract.rb b/app/validation/posts/post_contract.rb index 547de1b..9e23cb6 100644 --- a/app/validation/posts/post_contract.rb +++ b/app/validation/posts/post_contract.rb @@ -9,6 +9,7 @@ module Adamantium required(:published_at).maybe(:time) required(:slug).filled(:string) required(:post_type).value(included_in?: %w[post]) + required(:syndicate_to).array(:string) end end end