summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-08-10 16:27:46 +0300
committerAriadne Conill <ariadne@dereferenced.org>2019-08-14 01:50:21 +0000
commitba21d515d6ace80109b5f38934b33def8243e797 (patch)
tree6178c486afc3516270ad42896c17e4fadf8d34bd
parentdcd30e3cebc61c5b84cee123f450536003869dd0 (diff)
Mastodon API: Fix thread mute detection
It was calling CommonAPI.thread_muted? with post author's account instead of viewer's one.
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex2
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs4
3 files changed, 5 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 139af1fd6..8de2f2124 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [1.0.5] - 2019-08-??
### Fixed
- Mastodon API: follower/following counters not being nullified, when `hide_follows`/`hide_followers` is set
+- Mastodon API: `muted` in the Status entity, using author's account to determine if the thread was muted
## [1.0.4] - 2019-08-01
### Fixed
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index c183c9f4a..286fd08c7 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -160,7 +160,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
thread_muted? =
case activity.thread_muted? do
thread_muted? when is_boolean(thread_muted?) -> thread_muted?
- nil -> CommonAPI.thread_muted?(user, activity)
+ nil -> (opts[:for] && CommonAPI.thread_muted?(opts[:for], activity)) || false
end
attachment_data = object.data["attachment"] || []
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 152ba8137..7efdc7adb 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -2684,8 +2684,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
describe "conversation muting" do
setup do
+ post_user = insert(:user)
user = insert(:user)
- {:ok, activity} = CommonAPI.post(user, %{"status" => "HIE"})
+
+ {:ok, activity} = CommonAPI.post(post_user, %{"status" => "HIE"})
[user: user, activity: activity]
end