Compare commits

...

1 Commits

Author SHA1 Message Date
Moon Man c7b3e34c22 think I got all the URLs 2023-08-11 19:49:46 -04:00
16 changed files with 128 additions and 128 deletions

View File

@ -76,7 +76,7 @@ defp user_urls(%{local: true} = user) do
defp user_urls(%{local: false} = user) do
base_domain = Enum.random(["domain1.com", "domain2.com", "domain3.com"])
ap_id = "https://#{base_domain}/users/#{user.nickname}"
ap_id = "https://#{base_domain}/u/#{user.nickname}"
urls = %{
ap_id: ap_id,

View File

@ -122,14 +122,14 @@ def response("/notices/" <> id) do
user = User.get_cached_by_ap_id(activity.data["actor"])
info("Post #{activity.id} by #{user.nickname}") <>
link("More posts by #{user.nickname}", "/users/#{user.nickname}") <> activities <> ".\r\n"
link("More posts by #{user.nickname}", "/u/#{user.nickname}") <> activities <> ".\r\n"
else
_e ->
info("Not public") <> ".\r\n"
end
end
def response("/users/" <> nickname) do
def response("/u/" <> nickname) do
with %User{} = user <- User.get_cached_by_nickname(nickname) do
params = %{
type: ["Create"],

View File

@ -417,7 +417,7 @@ def banner_url(user, options \\ []) do
# Should probably be renamed or removed
@spec ap_id(User.t()) :: String.t()
def ap_id(%User{nickname: nickname}), do: "#{Endpoint.url()}/users/#{nickname}"
def ap_id(%User{nickname: nickname}), do: "#{Endpoint.url()}/u/#{nickname}"
@spec ap_followers(User.t()) :: String.t()
def ap_followers(%User{follower_address: fa}) when is_binary(fa), do: fa

View File

@ -318,7 +318,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
"sensitive" => false
},
"statuses_count" => 1,
"url" => "http://localhost:4001/users/nick6",
"url" => "http://localhost:4001/u/nick6",
"username" => "nick6"
},
"application" => nil,

View File

@ -233,31 +233,31 @@ defmodule Pleroma.Web.Router do
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
pipe_through([:admin_api, :require_admin])
get("/users/:nickname/permission_group", AdminAPIController, :right_get)
get("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_get)
get("/u/:nickname/permission_group", AdminAPIController, :right_get)
get("/u/:nickname/permission_group/:permission_group", AdminAPIController, :right_get)
post("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_add)
post("/u/:nickname/permission_group/:permission_group", AdminAPIController, :right_add)
delete(
"/users/:nickname/permission_group/:permission_group",
"/u/:nickname/permission_group/:permission_group",
AdminAPIController,
:right_delete
)
post("/users/permission_group/:permission_group", AdminAPIController, :right_add_multiple)
post("/u/permission_group/:permission_group", AdminAPIController, :right_add_multiple)
delete(
"/users/permission_group/:permission_group",
"/u/permission_group/:permission_group",
AdminAPIController,
:right_delete_multiple
)
post("/users/follow", UserController, :follow)
post("/users/unfollow", UserController, :unfollow)
post("/u/follow", UserController, :follow)
post("/u/unfollow", UserController, :unfollow)
post("/users", UserController, :create)
patch("/users/suggest", UserController, :suggest)
patch("/users/unsuggest", UserController, :unsuggest)
patch("/u/suggest", UserController, :suggest)
patch("/u/unsuggest", UserController, :unsuggest)
get("/relay", RelayController, :index)
post("/relay", RelayController, :follow)
@ -310,21 +310,21 @@ defmodule Pleroma.Web.Router do
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
pipe_through(:require_privileged_role_users_manage_credentials)
get("/users/:nickname/password_reset", AdminAPIController, :get_password_reset)
get("/users/:nickname/credentials", AdminAPIController, :show_user_credentials)
patch("/users/:nickname/credentials", AdminAPIController, :update_user_credentials)
put("/users/disable_mfa", AdminAPIController, :disable_mfa)
patch("/users/force_password_reset", AdminAPIController, :force_password_reset)
patch("/users/confirm_email", AdminAPIController, :confirm_email)
patch("/users/resend_confirmation_email", AdminAPIController, :resend_confirmation_email)
get("/u/:nickname/password_reset", AdminAPIController, :get_password_reset)
get("/u/:nickname/credentials", AdminAPIController, :show_user_credentials)
patch("/u/:nickname/credentials", AdminAPIController, :update_user_credentials)
put("/u/disable_mfa", AdminAPIController, :disable_mfa)
patch("/u/force_password_reset", AdminAPIController, :force_password_reset)
patch("/u/confirm_email", AdminAPIController, :confirm_email)
patch("/u/resend_confirmation_email", AdminAPIController, :resend_confirmation_email)
end
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
pipe_through(:require_privileged_role_messages_read)
get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses)
get("/users/:nickname/chats", AdminAPIController, :list_user_chats)
get("/u/:nickname/statuses", AdminAPIController, :list_user_statuses)
get("/u/:nickname/chats", AdminAPIController, :list_user_chats)
get("/statuses", StatusController, :index)
@ -340,28 +340,28 @@ defmodule Pleroma.Web.Router do
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
pipe_through(:require_privileged_role_users_manage_tags)
put("/users/tag", AdminAPIController, :tag_users)
delete("/users/tag", AdminAPIController, :untag_users)
put("/u/tag", AdminAPIController, :tag_users)
delete("/u/tag", AdminAPIController, :untag_users)
end
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
pipe_through(:require_privileged_role_users_manage_activation_state)
patch("/users/:nickname/toggle_activation", UserController, :toggle_activation)
patch("/users/activate", UserController, :activate)
patch("/users/deactivate", UserController, :deactivate)
patch("/u/:nickname/toggle_activation", UserController, :toggle_activation)
patch("/u/activate", UserController, :activate)
patch("/u/deactivate", UserController, :deactivate)
end
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
pipe_through(:require_privileged_role_users_manage_invites)
patch("/users/approve", UserController, :approve)
post("/users/invite_token", InviteController, :create)
get("/users/invites", InviteController, :index)
post("/users/revoke_invite", InviteController, :revoke)
post("/users/email_invite", InviteController, :email)
patch("/u/approve", UserController, :approve)
post("/u/invite_token", InviteController, :create)
get("/u/invites", InviteController, :index)
post("/u/revoke_invite", InviteController, :revoke)
post("/u/email_invite", InviteController, :email)
end
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
@ -380,7 +380,7 @@ defmodule Pleroma.Web.Router do
pipe_through(:require_privileged_role_users_read)
get("/users", UserController, :index)
get("/users/:nickname", UserController, :show)
get("/u/:nickname", UserController, :show)
end
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
@ -821,8 +821,8 @@ defmodule Pleroma.Web.Router do
get("/notice/:id", OStatus.OStatusController, :notice)
# Mastodon compatibility routes
get("/users/:nickname/statuses/:id", OStatus.OStatusController, :object)
get("/users/:nickname/statuses/:id/activity", OStatus.OStatusController, :activity)
get("/u/:nickname/statuses/:id", OStatus.OStatusController, :object)
get("/u/:nickname/statuses/:id/activity", OStatus.OStatusController, :activity)
end
scope "/", Pleroma.Web do
@ -831,13 +831,13 @@ defmodule Pleroma.Web.Router do
pipe_through([:accepts_html_xml_json, :http_signature, :static_fe])
# Note: returns user _profile_ for json requests, redirects to user _feed_ for non-json ones
get("/users/:nickname", Feed.UserController, :feed_redirect, as: :user_feed)
get("/u/:nickname", Feed.UserController, :feed_redirect, as: :user_feed)
end
scope "/", Pleroma.Web do
pipe_through([:accepts_html_xml])
get("/users/:nickname/feed", Feed.UserController, :feed, as: :user_feed)
get("/u/:nickname/feed", Feed.UserController, :feed, as: :user_feed)
end
scope "/", Pleroma.Web do
@ -877,22 +877,22 @@ defmodule Pleroma.Web.Router do
pipe_through([:activitypub_client])
get("/api/ap/whoami", ActivityPubController, :whoami)
get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
get("/u/:nickname/inbox", ActivityPubController, :read_inbox)
get("/users/:nickname/outbox", ActivityPubController, :outbox)
post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
get("/u/:nickname/outbox", ActivityPubController, :outbox)
post("/u/:nickname/outbox", ActivityPubController, :update_outbox)
post("/api/ap/upload_media", ActivityPubController, :upload_media)
# The following two are S2S as well, see `ActivityPub.fetch_follow_information_for_user/1`:
get("/users/:nickname/followers", ActivityPubController, :followers)
get("/users/:nickname/following", ActivityPubController, :following)
get("/users/:nickname/collections/featured", ActivityPubController, :pinned)
get("/u/:nickname/followers", ActivityPubController, :followers)
get("/u/:nickname/following", ActivityPubController, :following)
get("/u/:nickname/collections/featured", ActivityPubController, :pinned)
end
scope "/", Pleroma.Web.ActivityPub do
pipe_through(:activitypub)
post("/inbox", ActivityPubController, :inbox)
post("/users/:nickname/inbox", ActivityPubController, :inbox)
post("/u/:nickname/inbox", ActivityPubController, :inbox)
end
scope "/relay", Pleroma.Web.ActivityPub do

View File

@ -74,7 +74,7 @@ defp is_status?(acct) do
def do_follow(%{assigns: %{user: %User{} = user}} = conn, %{"user" => %{"id" => id}}) do
with {:fetch_user, %User{} = followee} <- {:fetch_user, User.get_cached_by_id(id)},
{:ok, _, _, _} <- CommonAPI.follow(user, followee) do
redirect(conn, to: "/users/#{followee.id}")
redirect(conn, to: "/u/#{followee.id}")
else
error ->
handle_follow_error(conn, error)
@ -91,7 +91,7 @@ def do_follow(conn, %{"authorization" => %{"name" => _, "password" => _, "id" =>
{_, {:ok, user}, _} <- {:auth, WrapperAuthenticator.get_user(conn), followee},
{_, _, _, false} <- {:mfa_required, followee, user, MFA.require?(user)},
{:ok, _, _, _} <- CommonAPI.follow(user, followee) do
redirect(conn, to: "/users/#{followee.id}")
redirect(conn, to: "/u/#{followee.id}")
else
error ->
handle_follow_error(conn, error)
@ -109,7 +109,7 @@ def do_follow(conn, %{"mfa" => %{"code" => code, "token" => token, "id" => id}})
{_, _, _, {:ok, _}} <-
{:verify_mfa_code, followee, token, TOTPAuthenticator.verify(code, user)},
{:ok, _, _, _} <- CommonAPI.follow(user, followee) do
redirect(conn, to: "/users/#{followee.id}")
redirect(conn, to: "/u/#{followee.id}")
else
error ->
handle_follow_error(conn, error)

View File

@ -19,6 +19,6 @@ def format_date(date) when is_binary(date) do
end
def admin_user_url(%{id: id}) do
Pleroma.Web.Endpoint.url() <> "/pleroma/admin/#/users/" <> id
Pleroma.Web.Endpoint.url() <> "/pleroma/admin/#/u/" <> id
end
end

View File

@ -32,7 +32,7 @@ def change do
{:ok, %{rows: ap_ids}} =
Ecto.Adapters.SQL.query(
Repo,
"select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{instance_uri}/users/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;",
"select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{instance_uri}/u/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;",
[],
timeout: :infinity
)

View File

@ -19,25 +19,25 @@
"sharedInbox": "https://{{domain}}/inbox",
"uploadMedia": "https://{{domain}}/api/ap/upload_media"
},
"followers": "https://{{domain}}/users/{{nickname}}/followers",
"following": "https://{{domain}}/users/{{nickname}}/following",
"followers": "https://{{domain}}/u/{{nickname}}/followers",
"following": "https://{{domain}}/u/{{nickname}}/following",
"icon": {
"type": "Image",
"url": "https://{{domain}}/media/a932a27f158b63c3a97e3a57d5384f714a82249274c6fc66c9eca581b4fd8af2.jpg"
},
"id": "https://{{domain}}/users/{{nickname}}",
"id": "https://{{domain}}/u/{{nickname}}",
"image": {
"type": "Image",
"url": "https://{{domain}}/media/db15f476d0ad14488db4762b7800479e6ef67b1824f8b9ea5c1fa05b7525c5b7.jpg"
},
"inbox": "https://{{domain}}/users/{{nickname}}/inbox",
"inbox": "https://{{domain}}/u/{{nickname}}/inbox",
"manuallyApprovesFollowers": false,
"name": "{{nickname}} :verified:",
"outbox": "https://{{domain}}/users/{{nickname}}/outbox",
"outbox": "https://{{domain}}/u/{{nickname}}/outbox",
"preferredUsername": "{{nickname}}",
"publicKey": {
"id": "https://{{domain}}/users/{{nickname}}#main-key",
"owner": "https://{{domain}}/users/{{nickname}}",
"id": "https://{{domain}}/u/{{nickname}}#main-key",
"owner": "https://{{domain}}/u/{{nickname}}",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu4XOAopC4nRIxNlHlt60\n//nCicuedu5wvLGIoQ+KUM2u7/PhLrrTDEqr1A7yQL95S0X8ryYtALgFLI5A54ww\nqjMIbIGAs44lEmDLMEd+XI+XxREE8wdsFpb4QQzWug0DTyqlMouTU25k0tfKh1rF\n4PMJ3uBSjDTAGgFvLNyFWTiVVgChbTNgGOmrEBucRl4NmKzQ69/FIUwENV88oQSU\n3bWvQTEH9rWH1rCLpkmQwdRiWfnhFX/4EUqXukfgoskvenKR8ff3nYhElDqFoE0e\nqUnIW1OZceyl8JewVLcL6m0/wdKeosTsfrcWc8DKfnRYQcBGNoBEq9GrOHDU0q2v\nyQIDAQAB\n-----END PUBLIC KEY-----\n\n"
},
"summary": "Pleroma BE dev",
@ -54,5 +54,5 @@
}
],
"type": "Person",
"url": "https://{{domain}}/users/{{nickname}}"
"url": "https://{{domain}}/u/{{nickname}}"
}

View File

@ -1,20 +1,20 @@
{
"aliases": [
"https://{{subdomain}}/users/{{nickname}}"
"https://{{subdomain}}/u/{{nickname}}"
],
"links": [
{
"href": "https://{{subdomain}}/users/{{nickname}}",
"href": "https://{{subdomain}}/u/{{nickname}}",
"rel": "http://webfinger.net/rel/profile-page",
"type": "text/html"
},
{
"href": "https://{{subdomain}}/users/{{nickname}}",
"href": "https://{{subdomain}}/u/{{nickname}}",
"rel": "self",
"type": "application/activity+json"
},
{
"href": "https://{{subdomain}}/users/{{nickname}}",
"href": "https://{{subdomain}}/u/{{nickname}}",
"rel": "self",
"type": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
},

View File

@ -151,7 +151,7 @@ test "untagging a user" do
test "ap_id returns the activity pub id for the user" do
user = UserBuilder.build()
expected_ap_id = "#{Pleroma.Web.Endpoint.url()}/users/#{user.nickname}"
expected_ap_id = "#{Pleroma.Web.Endpoint.url()}/u/#{user.nickname}"
assert expected_ap_id == User.ap_id(user)
end
@ -316,18 +316,18 @@ test "unfollow with synchronizes external user" do
followed =
insert(:user,
nickname: "fuser1",
follower_address: "http://localhost:4001/users/fuser1/followers",
following_address: "http://localhost:4001/users/fuser1/following",
ap_id: "http://localhost:4001/users/fuser1"
follower_address: "http://localhost:4001/u/fuser1/followers",
following_address: "http://localhost:4001/u/fuser1/following",
ap_id: "http://localhost:4001/u/fuser1"
)
user =
insert(:user, %{
local: false,
nickname: "fuser2",
ap_id: "http://localhost:4001/users/fuser2",
follower_address: "http://localhost:4001/users/fuser2/followers",
following_address: "http://localhost:4001/users/fuser2/following"
ap_id: "http://localhost:4001/u/fuser2",
follower_address: "http://localhost:4001/u/fuser2/followers",
following_address: "http://localhost:4001/u/fuser2/following"
})
{:ok, user, followed} = User.follow(user, followed, :follow_accept)
@ -845,7 +845,7 @@ test "gets an existing user by nickname" do
end
test "gets an existing user by ap_id" do
ap_id = "http://mastodon.example.org/users/admin"
ap_id = "http://mastodon.example.org/u/admin"
user =
insert(
@ -900,7 +900,7 @@ test "for mastodon" do
headers: [{"content-type", "application/jrd+json"}]
}
%{url: "https://sub.example.com/users/a"} ->
%{url: "https://sub.example.com/u/a"} ->
%Tesla.Env{
status: 200,
body:
@ -911,7 +911,7 @@ test "for mastodon" do
headers: [{"content-type", "application/activity+json"}]
}
%{url: "https://sub.example.com/users/a/collections/featured"} ->
%{url: "https://sub.example.com/u/a/collections/featured"} ->
%Tesla.Env{
status: 200,
body:
@ -925,7 +925,7 @@ test "for mastodon" do
ap_id = "a@example.com"
{:ok, fetched_user} = User.get_or_fetch(ap_id)
assert fetched_user.ap_id == "https://sub.example.com/users/a"
assert fetched_user.ap_id == "https://sub.example.com/u/a"
assert fetched_user.nickname == "a@example.com"
end
@ -958,7 +958,7 @@ test "for pleroma" do
headers: [{"content-type", "application/jrd+json"}]
}
%{url: "https://sub.example.com/users/a"} ->
%{url: "https://sub.example.com/u/a"} ->
%Tesla.Env{
status: 200,
body:
@ -973,7 +973,7 @@ test "for pleroma" do
ap_id = "a@example.com"
{:ok, fetched_user} = User.get_or_fetch(ap_id)
assert fetched_user.ap_id == "https://sub.example.com/users/a"
assert fetched_user.ap_id == "https://sub.example.com/u/a"
assert fetched_user.nickname == "a@example.com"
end
end
@ -1030,13 +1030,13 @@ test "updates an existing user, if stale" do
:user,
local: false,
nickname: "admin@mastodon.example.org",
ap_id: "http://mastodon.example.org/users/admin",
ap_id: "http://mastodon.example.org/u/admin",
last_refreshed_at: a_week_ago
)
assert orig_user.last_refreshed_at == a_week_ago
{:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/users/admin")
{:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/u/admin")
assert user.inbox
@ -1051,13 +1051,13 @@ test "if nicknames clash, the old user gets a prefix with the old id to the nick
:user,
local: false,
nickname: "admin@mastodon.example.org",
ap_id: "http://mastodon.example.org/users/harinezumigari",
ap_id: "http://mastodon.example.org/u/harinezumigari",
last_refreshed_at: a_week_ago
)
assert orig_user.last_refreshed_at == a_week_ago
{:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/users/admin")
{:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/u/admin")
assert user.inbox
@ -1077,13 +1077,13 @@ test "it returns the old user if stale, but unfetchable" do
:user,
local: false,
nickname: "admin@mastodon.example.org",
ap_id: "http://mastodon.example.org/users/raymoo",
ap_id: "http://mastodon.example.org/u/raymoo",
last_refreshed_at: a_week_ago
)
assert orig_user.last_refreshed_at == a_week_ago
{:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/users/raymoo")
{:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/u/raymoo")
assert user.last_refreshed_at == orig_user.last_refreshed_at
end
@ -1852,7 +1852,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do
fields: [%{"gg" => "qq"}],
raw_fields: [%{"gg" => "qq"}],
is_discoverable: true,
also_known_as: ["https://lol.olo/users/loll"]
also_known_as: ["https://lol.olo/u/loll"]
})
{:ok, job} = User.delete(user)
@ -1947,7 +1947,7 @@ test "unsuggests a user" do
end
test "get_public_key_for_ap_id fetches a user that's not in the db" do
assert {:ok, _key} = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
assert {:ok, _key} = User.get_public_key_for_ap_id("http://mastodon.example.org/u/admin")
end
describe "per-user rich-text filtering" do
@ -2235,7 +2235,7 @@ test "preserves hosts in user links text" do
end
test "Adds rel=me on linkbacked urls" do
user = insert(:user, ap_id: "https://social.example.org/users/lain")
user = insert(:user, ap_id: "https://social.example.org/u/lain")
bio = "http://example.com/rel_me/null"
expected_text = "<a href=\"#{bio}\">#{bio}</a>"
@ -2395,8 +2395,8 @@ test "it returns a list of AP ids in the same order" do
describe "sync followers count" do
setup do
user1 = insert(:user, local: false, ap_id: "http://localhost:4001/users/masto_closed")
user2 = insert(:user, local: false, ap_id: "http://localhost:4001/users/fuser2")
user1 = insert(:user, local: false, ap_id: "http://localhost:4001/u/masto_closed")
user2 = insert(:user, local: false, ap_id: "http://localhost:4001/u/fuser2")
insert(:user, local: true)
insert(:user, local: false, is_active: false)
{:ok, user1: user1, user2: user2}
@ -2470,8 +2470,8 @@ test "updates the counters normally on following/getting a follow when disabled"
other_user =
insert(:user,
local: false,
follower_address: "http://localhost:4001/users/masto_closed/followers",
following_address: "http://localhost:4001/users/masto_closed/following"
follower_address: "http://localhost:4001/u/masto_closed/followers",
following_address: "http://localhost:4001/u/masto_closed/following"
)
assert other_user.following_count == 0
@ -2491,8 +2491,8 @@ test "synchronizes the counters with the remote instance for the followed when e
other_user =
insert(:user,
local: false,
follower_address: "http://localhost:4001/users/masto_closed/followers",
following_address: "http://localhost:4001/users/masto_closed/following"
follower_address: "http://localhost:4001/u/masto_closed/followers",
following_address: "http://localhost:4001/u/masto_closed/following"
)
assert other_user.following_count == 0
@ -2512,8 +2512,8 @@ test "synchronizes the counters with the remote instance for the follower when e
other_user =
insert(:user,
local: false,
follower_address: "http://localhost:4001/users/masto_closed/followers",
following_address: "http://localhost:4001/users/masto_closed/following"
follower_address: "http://localhost:4001/u/masto_closed/followers",
following_address: "http://localhost:4001/u/masto_closed/following"
)
assert other_user.following_count == 0
@ -2680,7 +2680,7 @@ test "returns nickname without host" do
describe "full_nickname/1" do
test "returns fully qualified nickname for local and remote users" do
local_user =
insert(:user, nickname: "local_user", ap_id: "https://somehost.com/users/local_user")
insert(:user, nickname: "local_user", ap_id: "https://somehost.com/u/local_user")
remote_user = insert(:user, nickname: "remote@host.com", local: false)
@ -2712,7 +2712,7 @@ test "avatar fallback" do
end
test "get_host/1" do
user = insert(:user, ap_id: "https://lain.com/users/lain", nickname: "lain")
user = insert(:user, ap_id: "https://lain.com/u/lain", nickname: "lain")
assert User.get_host(user) == "lain.com"
end

View File

@ -112,7 +112,7 @@ test "works with Updates" do
defp build_media_message(opts \\ []) do
%{
"actor" => "https://remote.instance/users/bob",
"actor" => "https://remote.instance/u/bob",
"type" => opts[:type] || "Create",
"object" => %{
"attachment" => [%{}],
@ -153,7 +153,7 @@ test "match with wildcard domain" do
defp build_report_message do
%{
"actor" => "https://remote.instance/users/bob",
"actor" => "https://remote.instance/u/bob",
"type" => "Flag"
}
end
@ -283,8 +283,8 @@ test "reject Announce when object would be rejected" do
announce = %{
"type" => "Announce",
"actor" => "https://okay.tld/users/alice",
"object" => %{"type" => "Note", "actor" => "https://blocked.tld/users/bob"}
"actor" => "https://okay.tld/u/alice",
"object" => %{"type" => "Note", "actor" => "https://blocked.tld/u/bob"}
}
assert {:reject, _} = SimplePolicy.filter(announce)
@ -295,7 +295,7 @@ test "reject by URI object" do
announce = %{
"type" => "Announce",
"actor" => "https://okay.tld/users/alice",
"actor" => "https://okay.tld/u/alice",
"object" => "https://blocked.tld/activities/1"
}
@ -545,19 +545,19 @@ test "it rejects the deletion" do
defp build_local_message do
%{
"actor" => "#{Pleroma.Web.Endpoint.url()}/users/alice",
"actor" => "#{Pleroma.Web.Endpoint.url()}/u/alice",
"to" => [],
"cc" => []
}
end
defp build_remote_message do
%{"actor" => "https://remote.instance/users/bob"}
%{"actor" => "https://remote.instance/u/bob"}
end
defp build_remote_user do
%{
"id" => "https://remote.instance/users/bob",
"id" => "https://remote.instance/u/bob",
"icon" => %{
"url" => "http://example.com/image.jpg",
"type" => "Image"
@ -573,7 +573,7 @@ defp build_remote_user do
defp build_remote_deletion_message do
%{
"type" => "Delete",
"actor" => "https://remote.instance/users/bob"
"actor" => "https://remote.instance/u/bob"
}
end
end

View File

@ -29,7 +29,7 @@ test "it accepts Add/Remove activities" do
object_url = "https://example.com/objects/#{object_id}"
actor = "https://example.com/users/lain"
actor = "https://example.com/u/lain"
Tesla.Mock.mock(fn
%{
@ -52,7 +52,7 @@ test "it accepts Add/Remove activities" do
headers: [{"content-type", "application/activity+json"}]
}
%{method: :get, url: "https://example.com/users/lain/collections/featured"} ->
%{method: :get, url: "https://example.com/u/lain/collections/featured"} ->
%Tesla.Env{
status: 200,
body:
@ -68,10 +68,10 @@ test "it accepts Add/Remove activities" do
"id" => "https://example.com/objects/d61d6733-e256-4fe1-ab13-1e369789423f",
"actor" => actor,
"object" => object_url,
"target" => "https://example.com/users/lain/collections/featured",
"target" => "https://example.com/u/lain/collections/featured",
"type" => "Add",
"to" => [Pleroma.Constants.as_public()],
"cc" => ["https://example.com/users/lain/followers"],
"cc" => ["https://example.com/u/lain/followers"],
"bcc" => [],
"bto" => []
}
@ -85,10 +85,10 @@ test "it accepts Add/Remove activities" do
"id" => "http://localhost:400/objects/d61d6733-e256-4fe1-ab13-1e369789423d",
"actor" => actor,
"object" => object_url,
"target" => "https://example.com/users/lain/collections/featured",
"target" => "https://example.com/u/lain/collections/featured",
"type" => "Remove",
"to" => [Pleroma.Constants.as_public()],
"cc" => ["https://example.com/users/lain/followers"],
"cc" => ["https://example.com/u/lain/followers"],
"bcc" => [],
"bto" => []
}
@ -125,9 +125,9 @@ test "Add/Remove activities for remote users without featured address" do
object_url = "https://#{host}/objects/#{object_id}"
actor = "https://#{host}/users/#{user.nickname}"
actor = "https://#{host}/u/#{user.nickname}"
featured = "https://#{host}/users/#{user.nickname}/collections/featured"
featured = "https://#{host}/u/#{user.nickname}/collections/featured"
Tesla.Mock.mock(fn
%{
@ -166,10 +166,10 @@ test "Add/Remove activities for remote users without featured address" do
"id" => "https://#{host}/objects/d61d6733-e256-4fe1-ab13-1e369789423f",
"actor" => actor,
"object" => object_url,
"target" => "https://#{host}/users/#{user.nickname}/collections/featured",
"target" => "https://#{host}/u/#{user.nickname}/collections/featured",
"type" => "Add",
"to" => [Pleroma.Constants.as_public()],
"cc" => ["https://#{host}/users/#{user.nickname}/followers"],
"cc" => ["https://#{host}/u/#{user.nickname}/followers"],
"bcc" => [],
"bto" => []
}

View File

@ -96,7 +96,7 @@ test "gets an atom feed", %{conn: conn, user: user, object: object, max_id: max_
resp =
conn
|> put_req_header("accept", "application/atom+xml")
|> get("/users/#{user.nickname}/feed", %{"max_id" => max_id})
|> get("/u/#{user.nickname}/feed", %{"max_id" => max_id})
|> response(200)
activity_titles =
@ -111,7 +111,7 @@ test "gets a rss feed", %{conn: conn, user: user, object: object, max_id: max_id
resp =
conn
|> put_req_header("accept", "application/rss+xml")
|> get("/users/#{user.nickname}/feed.rss")
|> get("/u/#{user.nickname}/feed.rss")
|> response(200)
activity_titles =
@ -127,7 +127,7 @@ test "gets a rss feed", %{conn: conn, user: user, object: object, max_id: max_id
resp =
conn
|> put_req_header("accept", "application/rss+xml")
|> get("/users/#{user.nickname}/feed.rss", %{"max_id" => max_id})
|> get("/u/#{user.nickname}/feed.rss", %{"max_id" => max_id})
|> response(200)
activity_titles =
@ -187,7 +187,7 @@ test "does not require authentication on non-federating instances", %{conn: conn
conn
|> put_req_header("accept", "application/rss+xml")
|> get("/users/#{user.nickname}/feed.rss")
|> get("/u/#{user.nickname}/feed.rss")
|> response(200)
end
@ -224,7 +224,7 @@ test "with html format, it redirects to user feed", %{conn: conn} do
response =
conn
|> get("/users/#{user.nickname}")
|> get("/u/#{user.nickname}")
|> response(200)
assert response ==
@ -241,7 +241,7 @@ test "with html format, it falls back to frontend when user is remote", %{conn:
response =
conn
|> get("/users/#{user.nickname}")
|> get("/u/#{user.nickname}")
|> response(200)
assert response =~ "</html>"
@ -250,7 +250,7 @@ test "with html format, it falls back to frontend when user is remote", %{conn:
test "with html format, it falls back to frontend when user is not found", %{conn: conn} do
response =
conn
|> get("/users/jimm")
|> get("/u/jimm")
|> response(200)
assert response =~ "</html>"
@ -265,12 +265,12 @@ test "with non-html / non-json format, it redirects to user feed in atom format"
conn =
conn
|> put_req_header("accept", "application/xml")
|> get("/users/#{user.nickname}")
|> get("/u/#{user.nickname}")
assert conn.status == 302
assert redirected_to(conn) ==
"#{Pleroma.Web.Endpoint.url()}/users/#{user.nickname}/feed.atom"
"#{Pleroma.Web.Endpoint.url()}/u/#{user.nickname}/feed.atom"
end
test "with non-html / non-json format, it returns error when user is not found", %{conn: conn} do

View File

@ -57,7 +57,7 @@ def user_factory(attrs \\ %{}) do
if attrs[:local] == false do
base_domain = attrs[:domain] || Enum.random(["domain1.com", "domain2.com", "domain3.com"])
ap_id = "https://#{base_domain}/users/#{user.nickname}"
ap_id = "https://#{base_domain}/u/#{user.nickname}"
%{
ap_id: ap_id,

View File

@ -1009,7 +1009,7 @@ def get("http://localhost:8080/following/fuser3", _, _, _) do
}}
end
def get("http://localhost:4001/users/fuser2/followers", _, _, _) do
def get("http://localhost:4001/u/fuser2/followers", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
@ -1018,7 +1018,7 @@ def get("http://localhost:4001/users/fuser2/followers", _, _, _) do
}}
end
def get("http://localhost:4001/users/fuser2/following", _, _, _) do
def get("http://localhost:4001/u/fuser2/following", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
@ -1027,7 +1027,7 @@ def get("http://localhost:4001/users/fuser2/following", _, _, _) do
}}
end
def get("http://domain-with-errors:4001/users/fuser1/followers", _, _, _) do
def get("http://domain-with-errors:4001/u/fuser1/followers", _, _, _) do
{:ok,
%Tesla.Env{
status: 504,
@ -1035,7 +1035,7 @@ def get("http://domain-with-errors:4001/users/fuser1/followers", _, _, _) do
}}
end
def get("http://domain-with-errors:4001/users/fuser1/following", _, _, _) do
def get("http://domain-with-errors:4001/u/fuser1/following", _, _, _) do
{:ok,
%Tesla.Env{
status: 504,