diff options
author | lain <lain@soykaf.club> | 2020-04-20 14:08:54 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-04-20 14:08:54 +0200 |
commit | 7e53da250e3b41e01073148efea0fc4f49dea9d5 (patch) | |
tree | 91a692a3e7fcf703241b2fea4398ea7c32f07b48 /lib | |
parent | b836d3d104f75841d71f9cf7c5c8cb5c07ba7294 (diff) | |
download | pleroma-7e53da250e3b41e01073148efea0fc4f49dea9d5.tar.gz |
ChatMessage: Support emoji.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/builder.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/builder.ex b/lib/pleroma/web/activity_pub/builder.ex index b67166a30..7576ed278 100644 --- a/lib/pleroma/web/activity_pub/builder.ex +++ b/lib/pleroma/web/activity_pub/builder.ex @@ -5,6 +5,7 @@ defmodule Pleroma.Web.ActivityPub.Builder do This module encodes our addressing policies and general shape of our objects. """ + alias Pleroma.Emoji alias Pleroma.Object alias Pleroma.User alias Pleroma.Web.ActivityPub.Utils @@ -30,7 +31,8 @@ defmodule Pleroma.Web.ActivityPub.Builder do "type" => "ChatMessage", "to" => [recipient], "content" => content, - "published" => DateTime.utc_now() |> DateTime.to_iso8601() + "published" => DateTime.utc_now() |> DateTime.to_iso8601(), + "emoji" => Emoji.Formatter.get_emoji_map(content) }, []} end diff --git a/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex b/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex index 9b8262553..2feb65f29 100644 --- a/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex @@ -20,6 +20,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatMessageValidator do field(:content, :string) field(:actor, Types.ObjectID) field(:published, Types.DateTime) + field(:emoji, :map, default: %{}) end def cast_and_apply(data) do |