q = from(u in User, where: u.ap_id in ^likes)
users = Repo.all(q)
- users = if is_nil(user) do
- users
- else
- Enum.filter(users, &(not User.blocks?(user, &1)))
- end
+
+ users =
+ if is_nil(user) do
+ users
+ else
+ Enum.filter(users, &(not User.blocks?(user, &1)))
+ end
conn
|> put_view(AccountView)
q = from(u in User, where: u.ap_id in ^announces)
users = Repo.all(q)
- users = if is_nil(user) do
- users
- else
- Enum.filter(users, &(not User.blocks?(user, &1)))
- end
+
+ users =
+ if is_nil(user) do
+ users
+ else
+ Enum.filter(users, &(not User.blocks?(user, &1)))
+ end
conn
|> put_view(AccountView)
end
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
- other_user = insert(:user)
- {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
+ other_user = insert(:user)
+ {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
- response =
- conn
- |> assign(:user, nil)
- |> get("/api/v1/#{activity.id}/favourited_by")
- |> json_response(:ok)
+ response =
+ conn
+ |> assign(:user, nil)
+ |> get("/api/v1/#{activity.id}/favourited_by")
+ |> json_response(:ok)
- [%{"id" => id}] = response
- assert id == other_user.id
+ [%{"id" => id}] = response
+ assert id == other_user.id
end
end
end
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
- other_user = insert(:user)
- {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
+ other_user = insert(:user)
+ {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
- response =
- conn
- |> assign(:user, nil)
- |> get("/api/v1/#{activity.id}/reblogged_by")
- |> json_response(:ok)
+ response =
+ conn
+ |> assign(:user, nil)
+ |> get("/api/v1/#{activity.id}/reblogged_by")
+ |> json_response(:ok)
- [%{"id" => id}] = response
- assert id == other_user.id
+ [%{"id" => id}] = response
+ assert id == other_user.id
end
end