summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/views
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-09-13 16:31:27 +0200
committerlain <lain@soykaf.club>2019-09-13 16:31:27 +0200
commita7f31bf06cfe3f8e2549393f34d6573854d783c0 (patch)
treef53d6747ee73044f7b342d3fdae3d30b5b5b3c90 /test/web/mastodon_api/views
parentf649a2e972b70dfefb7bfc110b27a0194cda51c5 (diff)
parent0d9609894f4f4557da2db62a33da1b8995c9e1d7 (diff)
downloadpleroma-a7f31bf06cfe3f8e2549393f34d6573854d783c0.tar.gz
pleroma-a7f31bf06cfe3f8e2549393f34d6573854d783c0.zip
Merge remote-tracking branch 'origin/develop' into reactions
Diffstat (limited to 'test/web/mastodon_api/views')
-rw-r--r--test/web/mastodon_api/views/status_view_test.exs29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/web/mastodon_api/views/status_view_test.exs
index 1b6beb6d2..fcdd7fbcb 100644
--- a/test/web/mastodon_api/views/status_view_test.exs
+++ b/test/web/mastodon_api/views/status_view_test.exs
@@ -150,7 +150,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
content: %{"text/plain" => HtmlSanitizeEx.strip_tags(object_data["content"])},
spoiler_text: %{"text/plain" => HtmlSanitizeEx.strip_tags(object_data["summary"])},
expires_at: nil,
- direct_conversation_id: nil
+ direct_conversation_id: nil,
+ thread_muted: false
}
}
@@ -173,6 +174,24 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
assert status.muted == true
end
+ test "tells if the message is thread muted" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, user} = User.mute(user, other_user)
+
+ {:ok, activity} = CommonAPI.post(other_user, %{"status" => "test"})
+ status = StatusView.render("status.json", %{activity: activity, for: user})
+
+ assert status.pleroma.thread_muted == false
+
+ {:ok, activity} = CommonAPI.add_mute(user, activity)
+
+ status = StatusView.render("status.json", %{activity: activity, for: user})
+
+ assert status.pleroma.thread_muted == true
+ end
+
test "tells if the status is bookmarked" do
user = insert(:user)
@@ -532,6 +551,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
assert Enum.at(result[:options], 1)[:votes_count] == 1
assert Enum.at(result[:options], 2)[:votes_count] == 1
end
+
+ test "does not crash on polls with no end date" do
+ object = Object.normalize("https://skippers-bin.com/notes/7x9tmrp97i")
+ result = StatusView.render("poll.json", %{object: object})
+
+ assert result[:expires_at] == nil
+ assert result[:expired] == false
+ end
end
test "embeds a relationship in the account" do