Add backfilling of posts #846
6 changed files with 28 additions and 4 deletions
|
@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## UNRELEASED
|
## 3.13.3
|
||||||
|
|
||||||
## BREAKING
|
## BREAKING
|
||||||
- Minimum PostgreSQL version is raised to 12
|
- Minimum PostgreSQL version is raised to 12
|
||||||
|
|
|
@ -445,6 +445,7 @@ defp fix_follower_address(params), do: params
|
||||||
def remote_user_changeset(struct \\ %User{local: false}, params) do
|
def remote_user_changeset(struct \\ %User{local: false}, params) do
|
||||||
bio_limit = Config.get([:instance, :user_bio_length], 5000)
|
bio_limit = Config.get([:instance, :user_bio_length], 5000)
|
||||||
name_limit = Config.get([:instance, :user_name_length], 100)
|
name_limit = Config.get([:instance, :user_name_length], 100)
|
||||||
|
fields_limit = Config.get([:instance, :max_remote_account_fields], 0)
|
||||||
|
|
||||||
name =
|
name =
|
||||||
case params[:name] do
|
case params[:name] do
|
||||||
|
@ -458,6 +459,7 @@ def remote_user_changeset(struct \\ %User{local: false}, params) do
|
||||||
|> Map.put_new(:last_refreshed_at, NaiveDateTime.utc_now())
|
|> Map.put_new(:last_refreshed_at, NaiveDateTime.utc_now())
|
||||||
|> truncate_if_exists(:name, name_limit)
|
|> truncate_if_exists(:name, name_limit)
|
||||||
|> truncate_if_exists(:bio, bio_limit)
|
|> truncate_if_exists(:bio, bio_limit)
|
||||||
|
|> Map.update(:fields, [], &Enum.take(&1, fields_limit))
|
||||||
|> truncate_fields_param()
|
|> truncate_fields_param()
|
||||||
|> fix_follower_address()
|
|> fix_follower_address()
|
||||||
|
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :pleroma,
|
app: :pleroma,
|
||||||
version: version("3.13.2"),
|
version: version("3.13.3"),
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: Mix.compilers(),
|
compilers: Mix.compilers(),
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.AddSigningKeyIndex do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create_if_not_exists(index(:signing_keys, [:user_id], name: :signing_keys_user_id_index))
|
||||||
|
end
|
||||||
|
end
|
|
@ -966,6 +966,21 @@ test "it is invalid given a local user" do
|
||||||
|
|
||||||
refute cs.valid?
|
refute cs.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it truncates fields" do
|
||||||
|
clear_config([:instance, :max_remote_account_fields], 2)
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
%{"name" => "One", "value" => "Uno"},
|
||||||
|
%{"name" => "Two", "value" => "Dos"},
|
||||||
|
%{"name" => "Three", "value" => "Tres"}
|
||||||
|
]
|
||||||
|
|
||||||
|
cs = User.remote_user_changeset(@valid_remote |> Map.put(:fields, fields))
|
||||||
|
|
||||||
|
assert [%{"name" => "One", "value" => "Uno"}, %{"name" => "Two", "value" => "Dos"}] ==
|
||||||
|
Ecto.Changeset.get_field(cs, :fields)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "followers and friends" do
|
describe "followers and friends" do
|
||||||
|
|
|
@ -119,8 +119,8 @@ test "it works with custom profile fields" do
|
||||||
user = User.get_cached_by_ap_id(user.ap_id)
|
user = User.get_cached_by_ap_id(user.ap_id)
|
||||||
|
|
||||||
assert user.fields == [
|
assert user.fields == [
|
||||||
%{"name" => "foo", "value" => "updated"},
|
%{"name" => "foo", "value" => "bar"},
|
||||||
%{"name" => "foo1", "value" => "updated"}
|
%{"name" => "foo11", "value" => "bar11"}
|
||||||
]
|
]
|
||||||
|
|
||||||
update_data =
|
update_data =
|
||||||
|
|
Loading…
Reference in a new issue