diff options
author | puckipedia <puck@puckipedia.com> | 2017-10-27 16:10:36 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-10-27 16:10:36 +0200 |
commit | 0cb329f63a292598ef9ed1af6b8f8b56658e7984 (patch) | |
tree | cbd7476e97b2dab3aa51a1d4d38443471eb2246d /app/helpers | |
parent | 0129f5eada3d146c4e3550c7c82b94520a18d2ba (diff) |
Allow ActivityPub Note's tag and attachment to be single objects (#5534)
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/jsonld_helper.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/helpers/jsonld_helper.rb b/app/helpers/jsonld_helper.rb index c23a2e095..a3441e6f9 100644 --- a/app/helpers/jsonld_helper.rb +++ b/app/helpers/jsonld_helper.rb @@ -9,6 +9,10 @@ module JsonLdHelper value.is_a?(Array) ? value.first : value end + def as_array(value) + value.is_a?(Array) ? value : [value] + end + def value_or_id(value) value.is_a?(String) || value.nil? ? value : value['id'] end |