mix format

This commit is contained in:
Mirai Kumiko 2025-06-12 13:31:59 +02:00
parent f3c35e8e55
commit 385afb9308
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
6 changed files with 77 additions and 46 deletions

View file

@ -11,16 +11,18 @@ defmodule NullaWeb.FollowController do
offset = instance_settings.offset
user = User.get_user_by_username!(username)
total = Utils.count_following_by_username!(user.username)
page =
case Integer.parse(page_param) do
{int, _} when int > 0 -> int
_ -> 1
end
case Integer.parse(page_param) do
{int, _} when int > 0 -> int
_ -> 1
end
following_list = Utils.get_following_users_by_username!(user.username, page)
conn
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.following(domain, user, total, following_list, page, offset))
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.following(domain, user, total, following_list, page, offset))
end
def following(conn, %{"username" => username}) do
@ -30,8 +32,8 @@ defmodule NullaWeb.FollowController do
total = Utils.count_following_by_username!(user.username)
conn
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.following(domain, user, total))
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.following(domain, user, total))
end
def followers(conn, %{"username" => username, "page" => page_param}) do
@ -40,16 +42,18 @@ defmodule NullaWeb.FollowController do
offset = instance_settings.offset
user = User.get_user_by_username!(username)
total = Utils.count_followers_by_username!(user.username)
page =
case Integer.parse(page_param) do
{int, _} when int > 0 -> int
_ -> 1
end
case Integer.parse(page_param) do
{int, _} when int > 0 -> int
_ -> 1
end
followers_list = Utils.get_followers_by_username!(user.username, page)
conn
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.followers(domain, user, total, followers_list, page, offset))
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.followers(domain, user, total, followers_list, page, offset))
end
def followers(conn, %{"username" => username}) do
@ -59,7 +63,7 @@ defmodule NullaWeb.FollowController do
total = Utils.count_followers_by_username!(user.username)
conn
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.followers(domain, user, total))
|> put_resp_content_type("application/activity+json")
|> json(ActivityPub.followers(domain, user, total))
end
end