From: lain Date: Sat, 5 Oct 2019 08:42:29 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/develop' into reactions X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=d9aaea44ff02d6a07d3be0f0675830eb51ac85ef;p=akkoma Merge remote-tracking branch 'origin/develop' into reactions --- d9aaea44ff02d6a07d3be0f0675830eb51ac85ef diff --cc CHANGELOG.md index 35c062dcf,db505591b..3e6b791b4 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@@ -11,7 -12,7 +12,8 @@@ The format is based on [Keep a Changelo - Pleroma API: `GET /api/v1/pleroma/accounts/:id/scrobbles` to get a list of recently scrobbled items - Pleroma API: `POST /api/v1/pleroma/scrobble` to scrobble a media item - Mastodon API: Add `upload_limit`, `avatar_upload_limit`, `background_upload_limit`, and `banner_upload_limit` to `/api/v1/instance` + - Mastodon API: Add `pleroma.unread_conversation_count` to the Account entity +- Pleroma API: Add Emoji reactions ### Changed - **Breaking:** Elixir >=1.8 is now required (was >= 1.7) diff --cc lib/pleroma/web/activity_pub/utils.ex index 82e2d8f76,272011a9f..3e43e8fb8 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@@ -251,22 -251,6 +251,16 @@@ defmodule Pleroma.Web.ActivityPub.Util |> Repo.one() end + @doc """ + Returns like activities targeting an object + """ + def get_object_likes(%{data: %{"id" => id}}) do + id + |> Activity.Queries.by_object_id() + |> Activity.Queries.by_type("Like") + |> Repo.all() + end + - def make_emoji_reaction_data(user, object, emoji, activity_id) do - make_like_data(user, object, activity_id) - |> Map.put("type", "EmojiReaction") - |> Map.put("content", emoji) - end - @spec make_like_data(User.t(), map(), String.t()) :: map() def make_like_data( %User{ap_id: ap_id} = actor, @@@ -298,6 -282,6 +292,12 @@@ |> maybe_put("id", activity_id) end ++ def make_emoji_reaction_data(user, object, emoji, activity_id) do ++ make_like_data(user, object, activity_id) ++ |> Map.put("type", "EmojiReaction") ++ |> Map.put("content", emoji) ++ end ++ @spec update_element_in_object(String.t(), list(any), Object.t()) :: {:ok, Object.t()} | {:error, Ecto.Changeset.t()} def update_element_in_object(property, element, object) do diff --cc test/web/pleroma_api/controllers/pleroma_api_controller_test.exs index 3a5dbdeea,8a6528cbb..44ea85b45 --- a/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs +++ b/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs @@@ -7,8 -7,8 +7,9 @@@ defmodule Pleroma.Web.PleromaAPI.Plerom alias Pleroma.Conversation.Participation alias Pleroma.Notification + alias Pleroma.Object alias Pleroma.Repo + alias Pleroma.User alias Pleroma.Web.CommonAPI import Pleroma.Factory