end
end
+ # parse and put emoji to object data
+ defp put_emoji(map, text, emojis) do
+ Map.put(
+ map,
+ "emoji",
+ Map.merge(Emoji.Formatter.get_emoji_map(text), emojis)
+ )
+ end
+
# Updates the emojis for a user based on their profile
def update(user) do
+ emoji = emoji_from_profile(user)
+ source_data = user.info |> Map.get(:source_data, {}) |> Map.put("tag", emoji)
+
user =
- with emoji <- emoji_from_profile(user),
- source_data <- (user.info.source_data || %{}) |> Map.put("tag", emoji),
- info_cng <- User.Info.set_source_data(user.info, source_data),
- change <- Ecto.Changeset.change(user) |> Ecto.Changeset.put_embed(:info, info_cng),
- {:ok, user} <- User.update_and_set_cache(change) do
+ with {:ok, user} <- User.update_info(user, &User.Info.set_source_data(&1, source_data)) do
user
else
- _e ->
- user
+ _e -> user
end
ActivityPub.update(%{