mix format
This commit is contained in:
parent
f3c35e8e55
commit
385afb9308
6 changed files with 77 additions and 46 deletions
|
@ -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
|
||||
|
|
|
@ -49,10 +49,10 @@ defmodule NullaWeb.NoteController do
|
|||
end
|
||||
end
|
||||
|
||||
#def show(conn, %{"id" => id}) do
|
||||
# def show(conn, %{"id" => id}) do
|
||||
# note = Notes.get_note!(id)
|
||||
# render(conn, :show, note: note)
|
||||
#end
|
||||
# end
|
||||
|
||||
def edit(conn, %{"id" => id}) do
|
||||
note = Notes.get_note!(id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue