include local instance in bubble timeline (#117)
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/117 Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
5dabf69757
commit
195e46bcca
5 changed files with 18 additions and 27 deletions
|
@ -895,7 +895,6 @@ defmodule Pleroma.Web.Router do
|
|||
post("/tags/:id/follow", TagController, :follow)
|
||||
post("/tags/:id/unfollow", TagController, :unfollow)
|
||||
get("/followed_tags", TagController, :show_followed)
|
||||
end
|
||||
|
||||
post("/bite", BiteController, :bite)
|
||||
end
|
||||
|
|
|
@ -8,5 +8,7 @@ def change do
|
|||
end
|
||||
|
||||
create(unique_index(:user_follows_hashtag, [:user_id, :hashtag_id]))
|
||||
|
||||
create_if_not_exists(index(:user_follows_hashtag, [:hashtag_id]))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -412,7 +412,7 @@ test "We don't have unexpected tables which may contain objects that are referen
|
|||
["scheduled_activities"],
|
||||
["schema_migrations"],
|
||||
["thread_mutes"],
|
||||
# ["user_follows_hashtag"], # not in pleroma
|
||||
["user_follows_hashtag"],
|
||||
# ["user_frontend_setting_profiles"], # not in pleroma
|
||||
["user_invite_tokens"],
|
||||
["user_notes"],
|
||||
|
|
|
@ -864,13 +864,19 @@ test "it should return public activities that reference a given hashtag" do
|
|||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, normally_visible} = CommonAPI.post(other_user, %{status: "hello :)", visibility: "public"})
|
||||
{:ok, normally_visible} =
|
||||
CommonAPI.post(other_user, %{status: "hello :)", visibility: "public"})
|
||||
|
||||
{:ok, public} = CommonAPI.post(user, %{status: "maji #tenshi", visibility: "public"})
|
||||
{:ok, _unrelated} = CommonAPI.post(user, %{status: "dai #tensh", visibility: "public"})
|
||||
{:ok, unlisted} = CommonAPI.post(user, %{status: "maji #tenshi", visibility: "unlisted"})
|
||||
{:ok, _private} = CommonAPI.post(user, %{status: "maji #tenshi", visibility: "private"})
|
||||
|
||||
activities = ActivityPub.fetch_activities([other_user.follower_address], %{followed_hashtags: [hashtag.id]})
|
||||
activities =
|
||||
ActivityPub.fetch_activities([other_user.follower_address], %{
|
||||
followed_hashtags: [hashtag.id]
|
||||
})
|
||||
|
||||
assert length(activities) == 3
|
||||
normal_id = normally_visible.id
|
||||
public_id = public.id
|
||||
|
|
|
@ -459,10 +459,9 @@ test "should return 404 if disabled" do
|
|||
test "should not return 404 if local is specified" do
|
||||
clear_config([:instance, :federated_timeline_available], false)
|
||||
|
||||
result =
|
||||
build_conn()
|
||||
|> get("/api/v1/timelines/public?local=true")
|
||||
|> json_response_and_validate_schema(200)
|
||||
build_conn()
|
||||
|> get("/api/v1/timelines/public?local=true")
|
||||
|> json_response_and_validate_schema(200)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1093,18 +1092,10 @@ test "with `%{local: true, federated: false}`, forbids unauthenticated access to
|
|||
describe "bubble" do
|
||||
setup do: oauth_access(["read:statuses"])
|
||||
|
||||
test "it returns nothing if no bubble is configured", %{user: user, conn: conn} do
|
||||
clear_config([:instance, :local_bubble], [])
|
||||
{:ok, _} = CommonAPI.post(user, %{status: ".", visibility: "public"})
|
||||
|
||||
conn = get(conn, "/api/v1/timelines/bubble")
|
||||
|
||||
assert [] = json_response_and_validate_schema(conn, :ok)
|
||||
end
|
||||
|
||||
test "filtering", %{conn: conn, user: user} do
|
||||
clear_config([:instance, :local_bubble], [])
|
||||
local_user = insert(:user)
|
||||
# our endpoint host has a port in it so let's set the AP ID
|
||||
local_user = insert(:user, %{ap_id: "https://localhost/users/user"})
|
||||
remote_user = insert(:user, %{ap_id: "https://example.com/users/remote_user"})
|
||||
{:ok, user, local_user} = User.follow(user, local_user)
|
||||
{:ok, _user, remote_user} = User.follow(user, remote_user)
|
||||
|
@ -1112,15 +1103,8 @@ test "filtering", %{conn: conn, user: user} do
|
|||
{:ok, local_activity} = CommonAPI.post(local_user, %{status: "Status"})
|
||||
remote_activity = create_remote_activity(remote_user)
|
||||
|
||||
resp =
|
||||
conn
|
||||
|> get("/api/v1/timelines/bubble")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|> Enum.map(& &1["id"])
|
||||
|
||||
assert Enum.empty?(resp)
|
||||
|
||||
clear_config([:instance, :local_bubble], ["localhost:4001"])
|
||||
# If nothing, only include ours
|
||||
clear_config([:instance, :local_bubble], [])
|
||||
|
||||
one_instance =
|
||||
conn
|
||||
|
|
Loading…
Reference in a new issue