1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.CommonAPITest do
9 alias Pleroma.Conversation.Participation
12 alias Pleroma.Web.ActivityPub.ActivityPub
13 alias Pleroma.Web.ActivityPub.Transmogrifier
14 alias Pleroma.Web.ActivityPub.Visibility
15 alias Pleroma.Web.AdminAPI.AccountView
16 alias Pleroma.Web.CommonAPI
18 import Pleroma.Factory
21 require Pleroma.Constants
23 setup do: clear_config([:instance, :safe_dm_mentions])
24 setup do: clear_config([:instance, :limit])
25 setup do: clear_config([:instance, :max_pinned_statuses])
27 describe "posting chat messages" do
28 setup do: clear_config([:instance, :chat_limit])
30 test "it posts a chat message" do
31 author = insert(:user)
32 recipient = insert(:user)
35 CommonAPI.post_chat_message(
38 "a test message <script>alert('uuu')</script> :firefox:"
41 assert activity.data["type"] == "Create"
43 object = Object.normalize(activity)
45 assert object.data["type"] == "ChatMessage"
46 assert object.data["to"] == [recipient.ap_id]
48 assert object.data["content"] ==
49 "a test message <script>alert('uuu')</script> :firefox:"
51 assert object.data["emoji"] == %{
52 "firefox" => "http://localhost:4001/emoji/Firefox.gif"
55 assert Chat.get(author.id, recipient.ap_id)
56 assert Chat.get(recipient.id, author.ap_id)
58 assert :ok == Pleroma.Web.Federator.perform(:publish, activity)
61 test "it reject messages over the local limit" do
62 Pleroma.Config.put([:instance, :chat_limit], 2)
64 author = insert(:user)
65 recipient = insert(:user)
68 CommonAPI.post_chat_message(
74 assert message == :content_too_long
78 describe "deletion" do
79 test "it allows users to delete their posts" do
82 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
84 with_mock Pleroma.Web.Federator,
85 publish: fn _ -> nil end do
86 assert {:ok, delete} = CommonAPI.delete(post.id, user)
88 assert called(Pleroma.Web.Federator.publish(delete))
91 refute Activity.get_by_id(post.id)
94 test "it does not allow a user to delete their posts" do
96 other_user = insert(:user)
98 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
100 assert {:error, "Could not delete"} = CommonAPI.delete(post.id, other_user)
101 assert Activity.get_by_id(post.id)
104 test "it allows moderators to delete other user's posts" do
106 moderator = insert(:user, is_moderator: true)
108 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
110 assert {:ok, delete} = CommonAPI.delete(post.id, moderator)
113 refute Activity.get_by_id(post.id)
116 test "it allows admins to delete other user's posts" do
118 moderator = insert(:user, is_admin: true)
120 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
122 assert {:ok, delete} = CommonAPI.delete(post.id, moderator)
125 refute Activity.get_by_id(post.id)
128 test "superusers deleting non-local posts won't federate the delete" do
129 # This is the user of the ingested activity
133 ap_id: "http://mastodon.example.org/users/admin",
134 last_refreshed_at: NaiveDateTime.utc_now()
137 moderator = insert(:user, is_admin: true)
140 File.read!("test/fixtures/mastodon-post-activity.json")
143 {:ok, post} = Transmogrifier.handle_incoming(data)
145 with_mock Pleroma.Web.Federator,
146 publish: fn _ -> nil end do
147 assert {:ok, delete} = CommonAPI.delete(post.id, moderator)
149 refute called(Pleroma.Web.Federator.publish(:_))
152 refute Activity.get_by_id(post.id)
156 test "favoriting race condition" do
158 users_serial = insert_list(10, :user)
159 users = insert_list(10, :user)
161 {:ok, activity} = CommonAPI.post(user, %{"status" => "."})
164 |> Enum.map(fn user ->
165 CommonAPI.favorite(user, activity.id)
168 object = Object.get_by_ap_id(activity.data["object"])
169 assert object.data["like_count"] == 10
172 |> Enum.map(fn user ->
174 CommonAPI.favorite(user, activity.id)
177 |> Enum.map(&Task.await/1)
179 object = Object.get_by_ap_id(activity.data["object"])
180 assert object.data["like_count"] == 20
183 test "repeating race condition" do
185 users_serial = insert_list(10, :user)
186 users = insert_list(10, :user)
188 {:ok, activity} = CommonAPI.post(user, %{"status" => "."})
191 |> Enum.map(fn user ->
192 CommonAPI.repeat(activity.id, user)
195 object = Object.get_by_ap_id(activity.data["object"])
196 assert object.data["announcement_count"] == 10
199 |> Enum.map(fn user ->
201 CommonAPI.repeat(activity.id, user)
204 |> Enum.map(&Task.await/1)
206 object = Object.get_by_ap_id(activity.data["object"])
207 assert object.data["announcement_count"] == 20
210 test "when replying to a conversation / participation, it will set the correct context id even if no explicit reply_to is given" do
212 {:ok, activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "direct"})
214 [participation] = Participation.for_user(user)
217 CommonAPI.post(user, %{"status" => ".", "in_reply_to_conversation_id" => participation.id})
219 assert Visibility.is_direct?(convo_reply)
221 assert activity.data["context"] == convo_reply.data["context"]
224 test "when replying to a conversation / participation, it only mentions the recipients explicitly declared in the participation" do
226 jafnhar = insert(:user)
227 tridi = insert(:user)
230 CommonAPI.post(har, %{
231 "status" => "@#{jafnhar.nickname} hey",
232 "visibility" => "direct"
235 assert har.ap_id in activity.recipients
236 assert jafnhar.ap_id in activity.recipients
238 [participation] = Participation.for_user(har)
241 CommonAPI.post(har, %{
242 "status" => "I don't really like @#{tridi.nickname}",
243 "visibility" => "direct",
244 "in_reply_to_status_id" => activity.id,
245 "in_reply_to_conversation_id" => participation.id
248 assert har.ap_id in activity.recipients
249 assert jafnhar.ap_id in activity.recipients
250 refute tridi.ap_id in activity.recipients
253 test "with the safe_dm_mention option set, it does not mention people beyond the initial tags" do
255 jafnhar = insert(:user)
256 tridi = insert(:user)
258 Pleroma.Config.put([:instance, :safe_dm_mentions], true)
261 CommonAPI.post(har, %{
262 "status" => "@#{jafnhar.nickname} hey, i never want to see @#{tridi.nickname} again",
263 "visibility" => "direct"
266 refute tridi.ap_id in activity.recipients
267 assert jafnhar.ap_id in activity.recipients
270 test "it de-duplicates tags" do
272 {:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu #2HU"})
274 object = Object.normalize(activity)
276 assert object.data["tag"] == ["2hu"]
279 test "it adds emoji in the object" do
281 {:ok, activity} = CommonAPI.post(user, %{"status" => ":firefox:"})
283 assert Object.normalize(activity).data["emoji"]["firefox"]
286 describe "posting" do
287 test "it supports explicit addressing" do
289 user_two = insert(:user)
290 user_three = insert(:user)
291 user_four = insert(:user)
294 CommonAPI.post(user, %{
296 "Hey, I think @#{user_three.nickname} is ugly. @#{user_four.nickname} is alright though.",
297 "to" => [user_two.nickname, user_four.nickname, "nonexistent"]
300 assert user.ap_id in activity.recipients
301 assert user_two.ap_id in activity.recipients
302 assert user_four.ap_id in activity.recipients
303 refute user_three.ap_id in activity.recipients
306 test "it filters out obviously bad tags when accepting a post as HTML" do
309 post = "<p><b>2hu</b></p><script>alert('xss')</script>"
312 CommonAPI.post(user, %{
314 "content_type" => "text/html"
317 object = Object.normalize(activity)
319 assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')"
322 test "it filters out obviously bad tags when accepting a post as Markdown" do
325 post = "<p><b>2hu</b></p><script>alert('xss')</script>"
328 CommonAPI.post(user, %{
330 "content_type" => "text/markdown"
333 object = Object.normalize(activity)
335 assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')"
338 test "it does not allow replies to direct messages that are not direct messages themselves" do
341 {:ok, activity} = CommonAPI.post(user, %{"status" => "suya..", "visibility" => "direct"})
344 CommonAPI.post(user, %{
345 "status" => "suya..",
346 "visibility" => "direct",
347 "in_reply_to_status_id" => activity.id
350 Enum.each(["public", "private", "unlisted"], fn visibility ->
351 assert {:error, "The message visibility must be direct"} =
352 CommonAPI.post(user, %{
353 "status" => "suya..",
354 "visibility" => visibility,
355 "in_reply_to_status_id" => activity.id
360 test "it allows to address a list" do
362 {:ok, list} = Pleroma.List.create("foo", user)
365 CommonAPI.post(user, %{"status" => "foobar", "visibility" => "list:#{list.id}"})
367 assert activity.data["bcc"] == [list.ap_id]
368 assert activity.recipients == [list.ap_id, user.ap_id]
369 assert activity.data["listMessage"] == list.ap_id
372 test "it returns error when status is empty and no attachments" do
375 assert {:error, "Cannot post an empty status without attachments"} =
376 CommonAPI.post(user, %{"status" => ""})
379 test "it validates character limits are correctly enforced" do
380 Pleroma.Config.put([:instance, :limit], 5)
384 assert {:error, "The status is over the character limit"} =
385 CommonAPI.post(user, %{"status" => "foobar"})
387 assert {:ok, activity} = CommonAPI.post(user, %{"status" => "12345"})
390 test "it can handle activities that expire" do
394 NaiveDateTime.utc_now()
395 |> NaiveDateTime.truncate(:second)
396 |> NaiveDateTime.add(1_000_000, :second)
398 assert {:ok, activity} =
399 CommonAPI.post(user, %{"status" => "chai", "expires_in" => 1_000_000})
401 assert expiration = Pleroma.ActivityExpiration.get_by_activity_id(activity.id)
402 assert expiration.scheduled_at == expires_at
406 describe "reactions" do
407 test "reacting to a status with an emoji" do
409 other_user = insert(:user)
411 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
413 {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
415 assert reaction.data["actor"] == user.ap_id
416 assert reaction.data["content"] == "👍"
418 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
420 {:error, _} = CommonAPI.react_with_emoji(activity.id, user, ".")
423 test "unreacting to a status with an emoji" do
425 other_user = insert(:user)
427 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
428 {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
430 {:ok, unreaction} = CommonAPI.unreact_with_emoji(activity.id, user, "👍")
432 assert unreaction.data["type"] == "Undo"
433 assert unreaction.data["object"] == reaction.data["id"]
434 assert unreaction.local
437 test "repeating a status" do
439 other_user = insert(:user)
441 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
443 {:ok, %Activity{}, _} = CommonAPI.repeat(activity.id, user)
446 test "can't repeat a repeat" do
448 other_user = insert(:user)
449 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
451 {:ok, %Activity{} = announce, _} = CommonAPI.repeat(activity.id, other_user)
453 refute match?({:ok, %Activity{}, _}, CommonAPI.repeat(announce.id, user))
456 test "repeating a status privately" do
458 other_user = insert(:user)
460 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
462 {:ok, %Activity{} = announce_activity, _} =
463 CommonAPI.repeat(activity.id, user, %{"visibility" => "private"})
465 assert Visibility.is_private?(announce_activity)
468 test "favoriting a status" do
470 other_user = insert(:user)
472 {:ok, post_activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
474 {:ok, %Activity{data: data}} = CommonAPI.favorite(user, post_activity.id)
475 assert data["type"] == "Like"
476 assert data["actor"] == user.ap_id
477 assert data["object"] == post_activity.data["object"]
480 test "retweeting a status twice returns the status" do
482 other_user = insert(:user)
484 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
485 {:ok, %Activity{} = announce, object} = CommonAPI.repeat(activity.id, user)
486 {:ok, ^announce, ^object} = CommonAPI.repeat(activity.id, user)
489 test "favoriting a status twice returns ok, but without the like activity" do
491 other_user = insert(:user)
493 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
494 {:ok, %Activity{}} = CommonAPI.favorite(user, activity.id)
495 assert {:ok, :already_liked} = CommonAPI.favorite(user, activity.id)
499 describe "pinned statuses" do
501 Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
504 {:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
506 [user: user, activity: activity]
509 test "pin status", %{user: user, activity: activity} do
510 assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
513 user = refresh_record(user)
515 assert %User{pinned_activities: [^id]} = user
518 test "pin poll", %{user: user} do
520 CommonAPI.post(user, %{
521 "status" => "How is fediverse today?",
522 "poll" => %{"options" => ["Absolutely outstanding", "Not good"], "expires_in" => 20}
525 assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
528 user = refresh_record(user)
530 assert %User{pinned_activities: [^id]} = user
533 test "unlisted statuses can be pinned", %{user: user} do
534 {:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!", "visibility" => "unlisted"})
535 assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
538 test "only self-authored can be pinned", %{activity: activity} do
541 assert {:error, "Could not pin"} = CommonAPI.pin(activity.id, user)
544 test "max pinned statuses", %{user: user, activity: activity_one} do
545 {:ok, activity_two} = CommonAPI.post(user, %{"status" => "HI!!!"})
547 assert {:ok, ^activity_one} = CommonAPI.pin(activity_one.id, user)
549 user = refresh_record(user)
551 assert {:error, "You have already pinned the maximum number of statuses"} =
552 CommonAPI.pin(activity_two.id, user)
555 test "unpin status", %{user: user, activity: activity} do
556 {:ok, activity} = CommonAPI.pin(activity.id, user)
558 user = refresh_record(user)
562 assert match?({:ok, %{id: ^id}}, CommonAPI.unpin(activity.id, user))
564 user = refresh_record(user)
566 assert %User{pinned_activities: []} = user
569 test "should unpin when deleting a status", %{user: user, activity: activity} do
570 {:ok, activity} = CommonAPI.pin(activity.id, user)
572 user = refresh_record(user)
574 assert {:ok, _} = CommonAPI.delete(activity.id, user)
576 user = refresh_record(user)
578 assert %User{pinned_activities: []} = user
582 describe "mute tests" do
586 activity = insert(:note_activity)
588 [user: user, activity: activity]
591 test "add mute", %{user: user, activity: activity} do
592 {:ok, _} = CommonAPI.add_mute(user, activity)
593 assert CommonAPI.thread_muted?(user, activity)
596 test "remove mute", %{user: user, activity: activity} do
597 CommonAPI.add_mute(user, activity)
598 {:ok, _} = CommonAPI.remove_mute(user, activity)
599 refute CommonAPI.thread_muted?(user, activity)
602 test "check that mutes can't be duplicate", %{user: user, activity: activity} do
603 CommonAPI.add_mute(user, activity)
604 {:error, _} = CommonAPI.add_mute(user, activity)
608 describe "reports" do
609 test "creates a report" do
610 reporter = insert(:user)
611 target_user = insert(:user)
613 {:ok, activity} = CommonAPI.post(target_user, %{"status" => "foobar"})
615 reporter_ap_id = reporter.ap_id
616 target_ap_id = target_user.ap_id
617 activity_ap_id = activity.data["id"]
621 account_id: target_user.id,
623 status_ids: [activity.id]
628 "id" => activity_ap_id,
629 "content" => "foobar",
630 "published" => activity.object.data["published"],
631 "actor" => AccountView.render("show.json", %{user: target_user})
634 assert {:ok, flag_activity} = CommonAPI.report(reporter, report_data)
637 actor: ^reporter_ap_id,
640 "content" => ^comment,
641 "object" => [^target_ap_id, ^note_obj],
647 test "updates report state" do
648 [reporter, target_user] = insert_pair(:user)
649 activity = insert(:note_activity, user: target_user)
651 {:ok, %Activity{id: report_id}} =
652 CommonAPI.report(reporter, %{
653 account_id: target_user.id,
654 comment: "I feel offended",
655 status_ids: [activity.id]
658 {:ok, report} = CommonAPI.update_report_state(report_id, "resolved")
660 assert report.data["state"] == "resolved"
662 [reported_user, activity_id] = report.data["object"]
664 assert reported_user == target_user.ap_id
665 assert activity_id == activity.data["id"]
668 test "does not update report state when state is unsupported" do
669 [reporter, target_user] = insert_pair(:user)
670 activity = insert(:note_activity, user: target_user)
672 {:ok, %Activity{id: report_id}} =
673 CommonAPI.report(reporter, %{
674 account_id: target_user.id,
675 comment: "I feel offended",
676 status_ids: [activity.id]
679 assert CommonAPI.update_report_state(report_id, "test") == {:error, "Unsupported state"}
682 test "updates state of multiple reports" do
683 [reporter, target_user] = insert_pair(:user)
684 activity = insert(:note_activity, user: target_user)
686 {:ok, %Activity{id: first_report_id}} =
687 CommonAPI.report(reporter, %{
688 account_id: target_user.id,
689 comment: "I feel offended",
690 status_ids: [activity.id]
693 {:ok, %Activity{id: second_report_id}} =
694 CommonAPI.report(reporter, %{
695 account_id: target_user.id,
696 comment: "I feel very offended!",
697 status_ids: [activity.id]
701 CommonAPI.update_report_state([first_report_id, second_report_id], "resolved")
703 first_report = Activity.get_by_id(first_report_id)
704 second_report = Activity.get_by_id(second_report_id)
706 assert report_ids -- [first_report_id, second_report_id] == []
707 assert first_report.data["state"] == "resolved"
708 assert second_report.data["state"] == "resolved"
712 describe "reblog muting" do
714 muter = insert(:user)
716 muted = insert(:user)
718 [muter: muter, muted: muted]
721 test "add a reblog mute", %{muter: muter, muted: muted} do
722 {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muter, muted)
724 assert User.showing_reblogs?(muter, muted) == false
727 test "remove a reblog mute", %{muter: muter, muted: muted} do
728 {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muter, muted)
729 {:ok, _reblog_mute} = CommonAPI.show_reblogs(muter, muted)
731 assert User.showing_reblogs?(muter, muted) == true
735 describe "unfollow/2" do
736 test "also unsubscribes a user" do
737 [follower, followed] = insert_pair(:user)
738 {:ok, follower, followed, _} = CommonAPI.follow(follower, followed)
739 {:ok, _subscription} = User.subscribe(follower, followed)
741 assert User.subscribed_to?(follower, followed)
743 {:ok, follower} = CommonAPI.unfollow(follower, followed)
745 refute User.subscribed_to?(follower, followed)
748 test "cancels a pending follow for a local user" do
749 follower = insert(:user)
750 followed = insert(:user, locked: true)
752 assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
753 CommonAPI.follow(follower, followed)
755 assert User.get_follow_state(follower, followed) == :follow_pending
756 assert {:ok, follower} = CommonAPI.unfollow(follower, followed)
757 assert User.get_follow_state(follower, followed) == nil
759 assert %{id: ^activity_id, data: %{"state" => "cancelled"}} =
760 Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(follower, followed)
765 "object" => %{"type" => "Follow", "state" => "cancelled"}
767 } = Pleroma.Web.ActivityPub.Utils.fetch_latest_undo(follower)
770 test "cancels a pending follow for a remote user" do
771 follower = insert(:user)
772 followed = insert(:user, locked: true, local: false, ap_enabled: true)
774 assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
775 CommonAPI.follow(follower, followed)
777 assert User.get_follow_state(follower, followed) == :follow_pending
778 assert {:ok, follower} = CommonAPI.unfollow(follower, followed)
779 assert User.get_follow_state(follower, followed) == nil
781 assert %{id: ^activity_id, data: %{"state" => "cancelled"}} =
782 Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(follower, followed)
787 "object" => %{"type" => "Follow", "state" => "cancelled"}
789 } = Pleroma.Web.ActivityPub.Utils.fetch_latest_undo(follower)
793 describe "accept_follow_request/2" do
794 test "after acceptance, it sets all existing pending follow request states to 'accept'" do
795 user = insert(:user, locked: true)
796 follower = insert(:user)
797 follower_two = insert(:user)
799 {:ok, follow_activity} = ActivityPub.follow(follower, user)
800 {:ok, follow_activity_two} = ActivityPub.follow(follower, user)
801 {:ok, follow_activity_three} = ActivityPub.follow(follower_two, user)
803 assert follow_activity.data["state"] == "pending"
804 assert follow_activity_two.data["state"] == "pending"
805 assert follow_activity_three.data["state"] == "pending"
807 {:ok, _follower} = CommonAPI.accept_follow_request(follower, user)
809 assert Repo.get(Activity, follow_activity.id).data["state"] == "accept"
810 assert Repo.get(Activity, follow_activity_two.id).data["state"] == "accept"
811 assert Repo.get(Activity, follow_activity_three.id).data["state"] == "pending"
814 test "after rejection, it sets all existing pending follow request states to 'reject'" do
815 user = insert(:user, locked: true)
816 follower = insert(:user)
817 follower_two = insert(:user)
819 {:ok, follow_activity} = ActivityPub.follow(follower, user)
820 {:ok, follow_activity_two} = ActivityPub.follow(follower, user)
821 {:ok, follow_activity_three} = ActivityPub.follow(follower_two, user)
823 assert follow_activity.data["state"] == "pending"
824 assert follow_activity_two.data["state"] == "pending"
825 assert follow_activity_three.data["state"] == "pending"
827 {:ok, _follower} = CommonAPI.reject_follow_request(follower, user)
829 assert Repo.get(Activity, follow_activity.id).data["state"] == "reject"
830 assert Repo.get(Activity, follow_activity_two.id).data["state"] == "reject"
831 assert Repo.get(Activity, follow_activity_three.id).data["state"] == "pending"
834 test "doesn't create a following relationship if the corresponding follow request doesn't exist" do
835 user = insert(:user, locked: true)
836 not_follower = insert(:user)
837 CommonAPI.accept_follow_request(not_follower, user)
839 assert Pleroma.FollowingRelationship.following?(not_follower, user) == false
844 test "does not allow to vote twice" do
846 other_user = insert(:user)
849 CommonAPI.post(user, %{
850 "status" => "Am I cute?",
851 "poll" => %{"options" => ["Yes", "No"], "expires_in" => 20}
854 object = Object.normalize(activity)
856 {:ok, _, object} = CommonAPI.vote(other_user, object, [0])
858 assert {:error, "Already voted"} == CommonAPI.vote(other_user, object, [1])
862 describe "listen/2" do
863 test "returns a valid activity" do
867 CommonAPI.listen(user, %{
868 "title" => "lain radio episode 1",
869 "album" => "lain radio",
874 object = Object.normalize(activity)
876 assert object.data["title"] == "lain radio episode 1"
878 assert Visibility.get_visibility(activity) == "public"
881 test "respects visibility=private" do
885 CommonAPI.listen(user, %{
886 "title" => "lain radio episode 1",
887 "album" => "lain radio",
890 "visibility" => "private"
893 object = Object.normalize(activity)
895 assert object.data["title"] == "lain radio episode 1"
897 assert Visibility.get_visibility(activity) == "private"