summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml48
-rw-r--r--.gitlab/merge_request_templates/Default.md10
-rw-r--r--changelog.d/3882.add1
-rw-r--r--changelog.d/changelog-improve.skip0
-rw-r--r--priv/scrubbers/default.ex81
-rw-r--r--test/pleroma/web/common_api_test.exs11
-rw-r--r--tools/check-changelog26
7 files changed, 99 insertions, 78 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7e2d487de..8daa9f434 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -45,31 +45,39 @@ check-changelog:
stage: check-changelog
image: alpine
rules:
+ - if: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'pleroma/pleroma' && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == 'weblate-extract'
+ when: never
+ - if: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'pleroma/pleroma' && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == 'weblate'
+ when: never
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"
before_script: ''
after_script: ''
cache: {}
script:
+ - apk add git
- sh ./tools/check-changelog
+.build_changes_policy:
+ rules:
+ - changes:
+ - ".gitlab-ci.yml"
+ - "**/*.ex"
+ - "**/*.exs"
+ - "mix.lock"
+
build:
+ extends: .build_changes_policy
stage: build
- only:
- changes: &build_changes_policy
- - ".gitlab-ci.yml"
- - "**/*.ex"
- - "**/*.exs"
- - "mix.lock"
script:
- mix compile --force
spec-build:
stage: test
- only:
- changes:
- - ".gitlab-ci.yml"
- - "lib/pleroma/web/api_spec/**/*.ex"
- - "lib/pleroma/web/api_spec.ex"
+ rules:
+ - changes:
+ - ".gitlab-ci.yml"
+ - "lib/pleroma/web/api_spec/**/*.ex"
+ - "lib/pleroma/web/api_spec.ex"
artifacts:
paths:
- spec.json
@@ -91,9 +99,8 @@ benchmark:
- mix pleroma.load_testing
unit-testing:
+ extends: .build_changes_policy
stage: test
- only:
- changes: *build_changes_policy
cache: &testing_cache_policy
<<: *global_cache_policy
policy: pull
@@ -114,11 +121,10 @@ unit-testing:
path: coverage.xml
unit-testing-erratic:
+ extends: .build_changes_policy
stage: test
retry: 2
allow_failure: true
- only:
- changes: *build_changes_policy
cache: &testing_cache_policy
<<: *global_cache_policy
policy: pull
@@ -149,9 +155,8 @@ unit-testing-erratic:
# - mix test --trace --only federated
unit-testing-rum:
+ extends: .build_changes_policy
stage: test
- only:
- changes: *build_changes_policy
cache: *testing_cache_policy
services:
- name: minibikini/postgres-with-rum:12
@@ -167,10 +172,9 @@ unit-testing-rum:
- mix test --preload-modules
lint:
+ extends: .build_changes_policy
image: &current_elixir elixir:1.12-alpine
stage: test
- only:
- changes: *build_changes_policy
cache: *testing_cache_policy
before_script: &current_bfr_script
- apk update
@@ -182,18 +186,16 @@ lint:
- mix format --check-formatted
analysis:
+ extends: .build_changes_policy
stage: test
- only:
- changes: *build_changes_policy
cache: *testing_cache_policy
script:
- mix credo --strict --only=warnings,todo,fixme,consistency,readability
cycles:
+ extends: .build_changes_policy
image: *current_elixir
stage: test
- only:
- changes: *build_changes_policy
cache: {}
before_script: *current_bfr_script
script:
diff --git a/.gitlab/merge_request_templates/Default.md b/.gitlab/merge_request_templates/Default.md
new file mode 100644
index 000000000..fdf219f99
--- /dev/null
+++ b/.gitlab/merge_request_templates/Default.md
@@ -0,0 +1,10 @@
+### Checklist
+- [ ] Adding a changelog: In the `changelog.d` directory, create a file named `<code>.<type>`.
+
+ `<code>` can be anything, but we recommend using a more or less unique identifier to avoid collisions, such as the branch name.
+
+ `<type>` can be `add`, `remove`, `fix`, `security` or `skip`. `skip` is only used if there is no user-visible change in the MR (for example, only editing comments in the code). Otherwise, choose a type that corresponds to your change.
+
+ In the file, write the changelog entry. For example, if an MR adds group functionality, we can create a file named `group.add` and write `Add group functionality` in it.
+
+ If one changelog entry is not enough, you may add more. But that might mean you can split it into two MRs. Only use more than one changelog entry if you really need to (for example, when one change in the code fix two different bugs, or when refactoring).
diff --git a/changelog.d/3882.add b/changelog.d/3882.add
new file mode 100644
index 000000000..4712de1dc
--- /dev/null
+++ b/changelog.d/3882.add
@@ -0,0 +1 @@
+Allow lang attribute in status text
diff --git a/changelog.d/changelog-improve.skip b/changelog.d/changelog-improve.skip
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/changelog.d/changelog-improve.skip
diff --git a/priv/scrubbers/default.ex b/priv/scrubbers/default.ex
index e10e3ec87..d1215d2e0 100644
--- a/priv/scrubbers/default.ex
+++ b/priv/scrubbers/default.ex
@@ -33,35 +33,35 @@ defmodule Pleroma.HTML.Scrubber.Default do
"ugc"
])
- Meta.allow_tag_with_these_attributes(:a, ["name", "title"])
-
- Meta.allow_tag_with_these_attributes(:abbr, ["title"])
-
- Meta.allow_tag_with_these_attributes(:b, [])
- Meta.allow_tag_with_these_attributes(:blockquote, [])
- Meta.allow_tag_with_these_attributes(:br, [])
- Meta.allow_tag_with_these_attributes(:code, [])
- Meta.allow_tag_with_these_attributes(:del, [])
- Meta.allow_tag_with_these_attributes(:em, [])
- Meta.allow_tag_with_these_attributes(:hr, [])
- Meta.allow_tag_with_these_attributes(:i, [])
- Meta.allow_tag_with_these_attributes(:li, [])
- Meta.allow_tag_with_these_attributes(:ol, [])
- Meta.allow_tag_with_these_attributes(:p, [])
- Meta.allow_tag_with_these_attributes(:pre, [])
- Meta.allow_tag_with_these_attributes(:strong, [])
- Meta.allow_tag_with_these_attributes(:sub, [])
- Meta.allow_tag_with_these_attributes(:sup, [])
- Meta.allow_tag_with_these_attributes(:ruby, [])
- Meta.allow_tag_with_these_attributes(:rb, [])
- Meta.allow_tag_with_these_attributes(:rp, [])
- Meta.allow_tag_with_these_attributes(:rt, [])
- Meta.allow_tag_with_these_attributes(:rtc, [])
- Meta.allow_tag_with_these_attributes(:u, [])
- Meta.allow_tag_with_these_attributes(:ul, [])
+ Meta.allow_tag_with_these_attributes(:a, ["name", "title", "lang"])
+
+ Meta.allow_tag_with_these_attributes(:abbr, ["title", "lang"])
+
+ Meta.allow_tag_with_these_attributes(:b, ["lang"])
+ Meta.allow_tag_with_these_attributes(:blockquote, ["lang"])
+ Meta.allow_tag_with_these_attributes(:br, ["lang"])
+ Meta.allow_tag_with_these_attributes(:code, ["lang"])
+ Meta.allow_tag_with_these_attributes(:del, ["lang"])
+ Meta.allow_tag_with_these_attributes(:em, ["lang"])
+ Meta.allow_tag_with_these_attributes(:hr, ["lang"])
+ Meta.allow_tag_with_these_attributes(:i, ["lang"])
+ Meta.allow_tag_with_these_attributes(:li, ["lang"])
+ Meta.allow_tag_with_these_attributes(:ol, ["lang"])
+ Meta.allow_tag_with_these_attributes(:p, ["lang"])
+ Meta.allow_tag_with_these_attributes(:pre, ["lang"])
+ Meta.allow_tag_with_these_attributes(:strong, ["lang"])
+ Meta.allow_tag_with_these_attributes(:sub, ["lang"])
+ Meta.allow_tag_with_these_attributes(:sup, ["lang"])
+ Meta.allow_tag_with_these_attributes(:ruby, ["lang"])
+ Meta.allow_tag_with_these_attributes(:rb, ["lang"])
+ Meta.allow_tag_with_these_attributes(:rp, ["lang"])
+ Meta.allow_tag_with_these_attributes(:rt, ["lang"])
+ Meta.allow_tag_with_these_attributes(:rtc, ["lang"])
+ Meta.allow_tag_with_these_attributes(:u, ["lang"])
+ Meta.allow_tag_with_these_attributes(:ul, ["lang"])
Meta.allow_tag_with_this_attribute_values(:span, "class", ["h-card", "recipients-inline"])
- Meta.allow_tag_with_these_attributes(:span, [])
+ Meta.allow_tag_with_these_attributes(:span, ["lang"])
Meta.allow_tag_with_this_attribute_values(:code, "class", ["inline"])
@@ -77,29 +77,30 @@ defmodule Pleroma.HTML.Scrubber.Default do
"width",
"height",
"title",
- "alt"
+ "alt",
+ "lang"
])
end
if Pleroma.Config.get([:markup, :allow_tables]) do
- Meta.allow_tag_with_these_attributes(:table, [])
- Meta.allow_tag_with_these_attributes(:tbody, [])
- Meta.allow_tag_with_these_attributes(:td, [])
- Meta.allow_tag_with_these_attributes(:th, [])
- Meta.allow_tag_with_these_attributes(:thead, [])
- Meta.allow_tag_with_these_attributes(:tr, [])
+ Meta.allow_tag_with_these_attributes(:table, ["lang"])
+ Meta.allow_tag_with_these_attributes(:tbody, ["lang"])
+ Meta.allow_tag_with_these_attributes(:td, ["lang"])
+ Meta.allow_tag_with_these_attributes(:th, ["lang"])
+ Meta.allow_tag_with_these_attributes(:thead, ["lang"])
+ Meta.allow_tag_with_these_attributes(:tr, ["lang"])
end
if Pleroma.Config.get([:markup, :allow_headings]) do
- Meta.allow_tag_with_these_attributes(:h1, [])
- Meta.allow_tag_with_these_attributes(:h2, [])
- Meta.allow_tag_with_these_attributes(:h3, [])
- Meta.allow_tag_with_these_attributes(:h4, [])
- Meta.allow_tag_with_these_attributes(:h5, [])
+ Meta.allow_tag_with_these_attributes(:h1, ["lang"])
+ Meta.allow_tag_with_these_attributes(:h2, ["lang"])
+ Meta.allow_tag_with_these_attributes(:h3, ["lang"])
+ Meta.allow_tag_with_these_attributes(:h4, ["lang"])
+ Meta.allow_tag_with_these_attributes(:h5, ["lang"])
end
if Pleroma.Config.get([:markup, :allow_fonts]) do
- Meta.allow_tag_with_these_attributes(:font, ["face"])
+ Meta.allow_tag_with_these_attributes(:font, ["face", "lang"])
end
Meta.strip_everything_not_covered()
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs
index 5c9103e9f..968d826a2 100644
--- a/test/pleroma/web/common_api_test.exs
+++ b/test/pleroma/web/common_api_test.exs
@@ -527,6 +527,17 @@ defmodule Pleroma.Web.CommonAPITest do
assert Object.tags(object) == ["ساٴين‌س"]
end
+ test "allows lang attribute" do
+ user = insert(:user)
+ text = ~s{<span lang="en">something</span><p lang="diaetuitech_rpyhpgc">random</p>}
+
+ {:ok, activity} = CommonAPI.post(user, %{status: text, content_type: "text/html"})
+
+ object = Object.normalize(activity, fetch: false)
+
+ assert object.data["content"] == text
+ end
+
test "double dot in link is allowed" do
user = insert(:user)
text = "https://example.to/something..mp3"
diff --git a/tools/check-changelog b/tools/check-changelog
index b94b52755..60692033f 100644
--- a/tools/check-changelog
+++ b/tools/check-changelog
@@ -1,22 +1,18 @@
#!/bin/sh
-echo "looking for change log of $CI_MERGE_REQUEST_IID"
+echo "looking for change log"
-count=0
-for i in add remove fix security skip; do
- [ -f changelog.d/"$CI_MERGE_REQUEST_IID"."$i" ]
- retcode=$?
- if [ $retcode -eq 0 ]; then
- echo "found $CI_MERGE_REQUEST_IID.$i"
- count=$(( count + 1 ))
- else
- echo "no $CI_MERGE_REQUEST_IID.$i"
- fi
-done
-if [ $count -gt 0 ]; then
- echo "ok"
+git remote add upstream https://git.pleroma.social/pleroma/pleroma.git
+git fetch upstream ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}:refs/remotes/upstream/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
+
+git diff --raw --no-renames upstream/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME HEAD -- changelog.d | \
+ grep ' A\t' | grep '\.\(skip\|add\|remove\|fix\|security\)$'
+ret=$?
+
+if [ $ret -eq 0 ]; then
+ echo "found a changelog entry"
exit 0
else
- echo "must have a changelog entry or explicitly skip it"
+ echo "changelog entry not found"
exit 1
fi