- # TODO:
- # Go through these and fix them everywhere.
- # Wrong name, only returns create activities
- def all_by_object_ap_id_q(ap_id) do
- from activity in Activity,
- where: fragment("coalesce((?)->'object'->>'id', (?)->>'object') = ?", activity.data, activity.data, ^to_string(ap_id)),
+ def create_by_object_ap_id(ap_ids) when is_list(ap_ids) do
+ from(
+ activity in Activity,
+ where:
+ fragment(
+ "coalesce((?)->'object'->>'id', (?)->>'object') = ANY(?)",
+ activity.data,
+ activity.data,
+ ^ap_ids
+ ),