Merge branch 'feature/push-subject-for-dm' into 'develop'
[akkoma] / lib / pleroma / web / mastodon_api / controllers / status_controller.ex
index 2cbf3304697c92a9cc015ba604bae0bd0b766961..e5d016f63711dc0f899172448ddbef138a5f4cbb 100644 (file)
@@ -47,6 +47,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
          ]
   )
 
+  plug(OAuthScopesPlug, %{scopes: ["read:favourites"]} when action == :favourites)
+
   plug(
     OAuthScopesPlug,
     %{scopes: ["write:favourites"]} when action in [:favourite, :unfavourite]
@@ -65,6 +67,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
 
   plug(OAuthScopesPlug, %{scopes: ["write:accounts"]} when action in [:pin, :unpin])
 
+  # Note: scope not present in Mastodon: read:bookmarks
+  plug(OAuthScopesPlug, %{scopes: ["read:bookmarks"]} when action == :bookmarks)
+
   # Note: scope not present in Mastodon: write:bookmarks
   plug(
     OAuthScopesPlug,
@@ -162,7 +167,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
   def show(%{assigns: %{user: user}} = conn, %{"id" => id}) do
     with %Activity{} = activity <- Activity.get_by_id_with_object(id),
          true <- Visibility.visible_for_user?(activity, user) do
-      try_render(conn, "show.json", activity: activity, for: user)
+      try_render(conn, "show.json",
+        activity: activity,
+        for: user,
+        with_direct_conversation_id: true
+      )
     end
   end