#
# ```
# |> join(:inner, [activity], o in Object,
- # on: fragment("(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",
- # o.data, activity.data))
+ # on: fragment("(?->>'id') = COALESCE((?)->'object'->> 'id', (?)->>'object')",
+ # o.data, activity.data, activity.data))
# |> preload([activity, object], [object: object])
# ```
#
o in Object,
on:
fragment(
- "(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",
+ "(?->>'id') = COALESCE(?->'object'->>'id', ?->>'object')",
o.data,
+ activity.data,
activity.data
)
)
left_join: o in Object,
on:
fragment(
- "(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",
+ "(?->>'id') = COALESCE(?->'object'->>'id', ?->>'object')",
o.data,
+ activity.data,
activity.data
),
preload: [object: o]
inner_join: o in Object,
on:
fragment(
- "(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",
+ "(?->>'id') = COALESCE(?->'object'->>'id', ?->>'object')",
o.data,
+ activity.data,
activity.data
),
preload: [object: o]
inner_join: o in Object,
on:
fragment(
- "(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",
+ "(?->>'id') = COALESCE(?->'object'->>'id', ?->>'object')",
o.data,
+ activity.data,
activity.data
),
preload: [object: o]
assert Enum.member?(activities, activity_one)
end
+ test "does include announces on request" do
+ activity_three = insert(:note_activity)
+ user = insert(:user)
+ booster = insert(:user)
+
+ {:ok, user} = User.follow(user, booster)
+
+ {:ok, announce, _object} = CommonAPI.repeat(activity_three.id, booster)
+
+ [announce_activity] = ActivityPub.fetch_activities([user.ap_id | user.following])
+
+ assert announce_activity.id == announce.id
+ end
+
test "excludes reblogs on request" do
user = insert(:user)
{:ok, expected_activity} = ActivityBuilder.insert(%{"type" => "Create"}, %{:user => user})