diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs
new file mode 100644
index 000000000..865e7d782
--- /dev/null
+++ b/.dialyzer_ignore.exs
@@ -0,0 +1,6 @@
+[
+{"lib/cachex.ex", "Unknown type: Spec.cache/0."},
+{"lib/pleroma/web/plugs/rate_limiter.ex", "The pattern can never match the type {:commit, _} | {:ignore, _}."},
+{"lib/pleroma/web/plugs/rate_limiter.ex", "Function get_scale/2 will never be called."},
+{"lib/pleroma/web/plugs/rate_limiter.ex", "Function initialize_buckets!/1 will never be called."}
+]
diff --git a/.gitignore b/.gitignore
index 4009bd844..3b672184e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,5 +57,6 @@ pleroma.iml
.tool-versions
# Editor temp files
-/*~
-/*#
+*~
+*#
+*.swp
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd0561852..21d7b2242 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,13 @@
-image: git.pleroma.social:5050/pleroma/pleroma/ci-base
+image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.13.4-otp-24
variables: &global_variables
+ # Only used for the release
+ ELIXIR_VER: 1.13.4
POSTGRES_DB: pleroma_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DB_HOST: postgres
- DB_PORT: 5432
+ DB_PORT: "5432"
MIX_ENV: test
workflow:
@@ -24,9 +26,10 @@ cache: &global_cache_policy
- _build
stages:
- - check-changelog
- build
+ - lint
- test
+ - check-changelog
- benchmark
- deploy
- release
@@ -69,7 +72,7 @@ check-changelog:
tags:
- amd64
-build:
+build-1.13.4:
extends:
- .build_changes_policy
- .using-ci-base
@@ -77,10 +80,20 @@ build:
script:
- mix compile --force
+build-1.15.7-otp-25:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: build
+ image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.15-otp25
+ allow_failure: true
+ script:
+ - mix compile --force
+
spec-build:
extends:
- .using-ci-base
- stage: test
+ stage: build
rules:
- changes:
- ".gitlab-ci.yml"
@@ -100,7 +113,7 @@ benchmark:
variables:
MIX_ENV: benchmark
services:
- - name: postgres:9.6-alpine
+ - name: postgres:11.22-alpine
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
script:
@@ -108,7 +121,7 @@ benchmark:
- mix ecto.migrate
- mix pleroma.load_testing
-unit-testing:
+unit-testing-1.12.3:
extends:
- .build_changes_policy
- .using-ci-base
@@ -116,12 +129,11 @@ unit-testing:
cache: &testing_cache_policy
<<: *global_cache_policy
policy: pull
-
- services:
+ services: &testing_services
- name: postgres:13-alpine
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- script:
+ script: &testing_script
- mix ecto.create
- mix ecto.migrate
- mix test --cover --preload-modules
@@ -132,65 +144,35 @@ unit-testing:
coverage_format: cobertura
path: coverage.xml
-unit-testing-erratic:
+unit-testing-1.15.7-otp-25:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: test
+ image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.15-otp25
+ allow_failure: true
+ cache: *testing_cache_policy
+ services: *testing_services
+ script: *testing_script
+
+unit-testing-1.12-erratic:
extends:
- .build_changes_policy
- .using-ci-base
stage: test
retry: 2
allow_failure: true
- cache: &testing_cache_policy
- <<: *global_cache_policy
- policy: pull
-
- services:
- - name: postgres:13-alpine
- alias: postgres
- command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
+ cache: *testing_cache_policy
+ services: *testing_services
script:
- mix ecto.create
- mix ecto.migrate
- mix test --only=erratic
-# Removed to fix CI issue. In this early state it wasn't adding much value anyway.
-# TODO Fix and reinstate federated testing
-# federated-testing:
-# stage: test
-# cache: *testing_cache_policy
-# services:
-# - name: minibikini/postgres-with-rum:12
-# alias: postgres
-# command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
-# script:
-# - mix deps.get
-# - mix ecto.create
-# - mix ecto.migrate
-# - epmd -daemon
-# - mix test --trace --only federated
-
-unit-testing-rum:
- extends:
- - .build_changes_policy
- - .using-ci-base
- stage: test
- cache: *testing_cache_policy
- services:
- - name: minibikini/postgres-with-rum:12
- alias: postgres
- command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- variables:
- <<: *global_variables
- RUM_ENABLED: "true"
- script:
- - mix ecto.create
- - mix ecto.migrate
- - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
- - mix test --preload-modules
-
-lint:
+formatting-1.13:
extends: .build_changes_policy
- image: ¤t_elixir elixir:1.12-alpine
- stage: test
+ image: &formatting_elixir elixir:1.13-alpine
+ stage: lint
cache: *testing_cache_policy
before_script: ¤t_bfr_script
- apk update
@@ -201,25 +183,38 @@ lint:
script:
- mix format --check-formatted
-analysis:
- extends:
- - .build_changes_policy
- - .using-ci-base
- stage: test
- cache: *testing_cache_policy
- script:
- - mix credo --strict --only=warnings,todo,fixme,consistency,readability
-
-cycles:
+cycles-1.13:
extends: .build_changes_policy
- image: *current_elixir
- stage: test
+ image: *formatting_elixir
+ stage: lint
cache: {}
before_script: *current_bfr_script
script:
- mix compile
- mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}'
+analysis:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: lint
+ cache: *testing_cache_policy
+ script:
+ - mix credo --strict --only=warnings,todo,fixme,consistency,readability
+
+dialyzer:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: lint
+ allow_failure: true
+ when: manual
+ cache: *testing_cache_policy
+ tags:
+ - feld
+ script:
+ - mix dialyzer
+
docs-deploy:
stage: deploy
cache: *testing_cache_policy
@@ -294,7 +289,7 @@ stop_review_app:
amd64:
stage: release
- image: elixir:1.11.4
+ image: elixir:$ELIXIR_VER
only: &release-only
- stable@pleroma/pleroma
- develop@pleroma/pleroma
@@ -318,8 +313,9 @@ amd64:
- deps
variables: &release-variables
MIX_ENV: prod
+ VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
before_script: &before-release
- - apt-get update && apt-get install -y cmake libmagic-dev
+ - apt-get update && apt-get install -y cmake libmagic-dev libvips-dev erlang-dev
- echo "import Config" > config/prod.secret.exs
- mix local.hex --force
- mix local.rebar --force
@@ -334,13 +330,13 @@ amd64-musl:
stage: release
artifacts: *release-artifacts
only: *release-only
- image: elixir:1.11.4-alpine
+ image: elixir:$ELIXIR_VER-alpine
tags:
- amd64
cache: *release-cache
variables: *release-variables
before_script: &before-release-musl
- - apk add git build-base cmake file-dev openssl
+ - apk add git build-base cmake file-dev openssl vips-dev
- echo "import Config" > config/prod.secret.exs
- mix local.hex --force
- mix local.rebar --force
@@ -352,7 +348,7 @@ arm:
only: *release-only
tags:
- arm32-specified
- image: arm32v7/elixir:1.11.4
+ image: arm32v7/elixir:$ELIXIR_VER
cache: *release-cache
variables: *release-variables
before_script: *before-release
@@ -364,7 +360,7 @@ arm-musl:
only: *release-only
tags:
- arm32-specified
- image: arm32v7/elixir:1.11.4-alpine
+ image: arm32v7/elixir:$ELIXIR_VER-alpine
cache: *release-cache
variables: *release-variables
before_script: *before-release-musl
@@ -376,7 +372,7 @@ arm64:
only: *release-only
tags:
- arm
- image: arm64v8/elixir:1.11.4
+ image: arm64v8/elixir:$ELIXIR_VER
cache: *release-cache
variables: *release-variables
before_script: *before-release
@@ -388,7 +384,7 @@ arm64-musl:
only: *release-only
tags:
- arm
- image: arm64v8/elixir:1.11.4-alpine
+ image: arm64v8/elixir:$ELIXIR_VER-alpine
cache: *release-cache
variables: *release-variables
before_script: *before-release-musl
diff --git a/.gitlab/merge_request_templates/Default.md b/.gitlab/merge_request_templates/Default.md
index fdf219f99..641d9cfd8 100644
--- a/.gitlab/merge_request_templates/Default.md
+++ b/.gitlab/merge_request_templates/Default.md
@@ -3,7 +3,7 @@
`` can be anything, but we recommend using a more or less unique identifier to avoid collisions, such as the branch name.
- `
#{quote_line}"
+ end
+
+ defp has_inline_quote?(content, quote_url) do
+ cond do
+ # Does the quote URL exist in the content?
+ content =~ quote_url -> true
+ # Does the content already have a .quote-inline span?
+ content =~ "" -> true
+ # No inline quote found
+ true -> false
+ end
+ end
+
+ defp filter_object(%{"quoteUrl" => quote_url} = object) do
+ content = object["content"] || ""
+
+ if has_inline_quote?(content, quote_url) do
+ object
+ else
+ template = Pleroma.Config.get([:mrf_inline_quote, :template])
+
+ content =
+ if String.ends_with?(content, "