Mastodon API: Fix thread mute detection

It was calling CommonAPI.thread_muted? with post author's account
instead of viewer's one.
This commit is contained in:
rinpatch 2019-08-10 16:27:46 +03:00 committed by Ariadne Conill
parent dcd30e3ceb
commit ba21d515d6
3 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -160,7 +160,7 @@ def render("status.json", %{activity: %{data: %{"object" => _object}} = activity
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"] || []

View file

@ -2684,8 +2684,10 @@ test "bookmarks" 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