Remove most usage of `User.Info.source_data`
We keep the original json data we used when fetching a user in the source_data
field. This field should never be used by views or most other parts of code. Its only reason to stay around is to backfill missing data in case we add new features.
Relevant parts of the code:
test/user_test.exs
442: assert user.info.source_data["endpoints"]
test/formatter_test.exs
128: info: %Pleroma.User.Info{source_data: %{"url" => "https://archeme/@archa_eme_"}}
test/web/federator_test.exs
73: info: %{ap_enabled: true, source_data: %{"inbox" => inbox1}}
80: info: %{ap_enabled: true, source_data: %{"inbox" => inbox2}}
lib/pleroma/formatter.ex
138: defp get_ap_id(%User{info: %{source_data: %{"url" => url}}}) when is_binary(url), do: url
lib/pleroma/user.ex
98: def profile_url(%User{info: %{source_data: %{"url" => url}}}), do: url
141: case info_cng.changes[:source_data] do
561: Enum.reverse(Utils.fetch_ordered_collection(user.info.source_data["outbox"], pages)),
1190: source_data: %{"publicKey" => %{"publicKeyPem" => public_key_pem}}
1261: def parse_bio(bio, user \\ %User{info: %{source_data: %{}}})
1267: (user.info.source_data["tag"] || [])
test/web/activity_pub/activity_pub_test.exs
75: assert user.info.source_data
test/web/ostatus/ostatus_test.exs
383: source_data: %{},
test/web/mastodon_api/account_view_test.exs
12: source_data = %{
24: info: %{note_count: 5, follower_count: 3, source_data: source_data},
77: info: %{note_count: 5, follower_count: 3, source_data: %{"type" => "Service"}},
157: info: %{note_count: 5, follower_count: 3, source_data: %{"type" => "Service"}},
test/web/common_api/common_api_test.exs
50: [karjalanpiirakka] = user.info.source_data["tag"]
lib/pleroma/user/info.ex
14: field(:source_data, :map, default: %{})
140: :source_data,
155: :source_data,
218: def set_source_data(info, source_data) do
219: params = %{source_data: source_data}
222: |> cast(params, [:source_data])
223: |> validate_required([:source_data])
test/web/twitter_api/views/user_view_test.exs
40: source_data: %{
314: source_data: %{
lib/pleroma/web/activity_pub/activity_pub.ex
859: "source_data" => data,
937: |> Enum.map(fn %{info: %{source_data: data}} ->
lib/pleroma/web/common_api/common_api.ex
194: source_data <- (user.info.source_data || %{}) |> Map.put("tag", emoji),
195: info_cng <- Pleroma.User.Info.set_source_data(user.info, source_data),
lib/pleroma/web/activity_pub/views/user_view.ex
90: "tag" => user.info.source_data["tag"] || []
lib/pleroma/web/twitter_api/views/user_view.ex
64: (user.info.source_data["tag"] || [])
73: (user.info.source_data["attachment"] || [])
lib/pleroma/web/mastodon_api/views/account_view.ex
71: bot = (user.info.source_data["type"] || "Person") in ["Application", "Service"]
74: (user.info.source_data["tag"] || [])
86: (user.info.source_data["attachment"] || [])