mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-11-16 07:06:49 +01:00
Merge remote-tracking branch 'upstream/develop' into neckbeard
This commit is contained in:
commit
da1b8fa56c
@ -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: ¤t_elixir elixir:1.12-alpine
|
||||
stage: test
|
||||
only:
|
||||
changes: *build_changes_policy
|
||||
cache: *testing_cache_policy
|
||||
before_script: ¤t_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:
|
||||
|
10
.gitlab/merge_request_templates/Default.md
Normal file
10
.gitlab/merge_request_templates/Default.md
Normal file
@ -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).
|
1
changelog.d/3848.add
Normal file
1
changelog.d/3848.add
Normal file
@ -0,0 +1 @@
|
||||
Add OAuth scope descriptions
|
1
changelog.d/3882.add
Normal file
1
changelog.d/3882.add
Normal file
@ -0,0 +1 @@
|
||||
Allow lang attribute in status text
|
1
changelog.d/3883.fix
Normal file
1
changelog.d/3883.fix
Normal file
@ -0,0 +1 @@
|
||||
Fix abnormal behaviour when refetching a poll
|
0
changelog.d/changelog-improve.skip
Normal file
0
changelog.d/changelog-improve.skip
Normal file
@ -8,77 +8,30 @@ defmodule Pleroma.Object.Fetcher do
|
||||
alias Pleroma.Maps
|
||||
alias Pleroma.Object
|
||||
alias Pleroma.Object.Containment
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.Signature
|
||||
alias Pleroma.Web.ActivityPub.InternalFetchActor
|
||||
alias Pleroma.Web.ActivityPub.MRF
|
||||
alias Pleroma.Web.ActivityPub.ObjectValidator
|
||||
alias Pleroma.Web.ActivityPub.Pipeline
|
||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||
alias Pleroma.Web.Federator
|
||||
|
||||
require Logger
|
||||
require Pleroma.Constants
|
||||
|
||||
defp touch_changeset(changeset) do
|
||||
updated_at =
|
||||
NaiveDateTime.utc_now()
|
||||
|> NaiveDateTime.truncate(:second)
|
||||
|
||||
Ecto.Changeset.put_change(changeset, :updated_at, updated_at)
|
||||
end
|
||||
|
||||
defp maybe_reinject_internal_fields(%{data: %{} = old_data}, new_data) do
|
||||
has_history? = fn
|
||||
%{"formerRepresentations" => %{"orderedItems" => list}} when is_list(list) -> true
|
||||
_ -> false
|
||||
end
|
||||
|
||||
internal_fields = Map.take(old_data, Pleroma.Constants.object_internal_fields())
|
||||
|
||||
remote_history_exists? = has_history?.(new_data)
|
||||
|
||||
# If the remote history exists, we treat that as the only source of truth.
|
||||
new_data =
|
||||
if has_history?.(old_data) and not remote_history_exists? do
|
||||
Map.put(new_data, "formerRepresentations", old_data["formerRepresentations"])
|
||||
else
|
||||
new_data
|
||||
end
|
||||
|
||||
# If the remote does not have history information, we need to manage it ourselves
|
||||
new_data =
|
||||
if not remote_history_exists? do
|
||||
changed? =
|
||||
Pleroma.Constants.status_updatable_fields()
|
||||
|> Enum.any?(fn field -> Map.get(old_data, field) != Map.get(new_data, field) end)
|
||||
|
||||
%{updated_object: updated_object} =
|
||||
new_data
|
||||
|> Object.Updater.maybe_update_history(old_data,
|
||||
updated: changed?,
|
||||
use_history_in_new_object?: false
|
||||
)
|
||||
|
||||
updated_object
|
||||
else
|
||||
new_data
|
||||
end
|
||||
|
||||
Map.merge(new_data, internal_fields)
|
||||
end
|
||||
|
||||
defp maybe_reinject_internal_fields(_, new_data), do: new_data
|
||||
|
||||
@spec reinject_object(struct(), map()) :: {:ok, Object.t()} | {:error, any()}
|
||||
defp reinject_object(%Object{data: %{"type" => "Question"}} = object, new_data) do
|
||||
defp reinject_object(%Object{data: %{}} = object, new_data) do
|
||||
Logger.debug("Reinjecting object #{new_data["id"]}")
|
||||
|
||||
with data <- maybe_reinject_internal_fields(object, new_data),
|
||||
{:ok, data, _} <- ObjectValidator.validate(data, %{}),
|
||||
changeset <- Object.change(object, %{data: data}),
|
||||
changeset <- touch_changeset(changeset),
|
||||
{:ok, object} <- Repo.insert_or_update(changeset),
|
||||
{:ok, object} <- Object.set_cache(object) do
|
||||
{:ok, object}
|
||||
with {:ok, new_data, _} <- ObjectValidator.validate(new_data, %{}),
|
||||
{:ok, new_data} <- MRF.filter(new_data),
|
||||
{:ok, new_object, _} <-
|
||||
Object.Updater.do_update_and_invalidate_cache(
|
||||
object,
|
||||
new_data,
|
||||
_touch_changeset? = true
|
||||
) do
|
||||
{:ok, new_object}
|
||||
else
|
||||
e ->
|
||||
Logger.error("Error while processing object: #{inspect(e)}")
|
||||
@ -86,20 +39,11 @@ defmodule Pleroma.Object.Fetcher do
|
||||
end
|
||||
end
|
||||
|
||||
defp reinject_object(%Object{} = object, new_data) do
|
||||
Logger.debug("Reinjecting object #{new_data["id"]}")
|
||||
|
||||
with new_data <- Transmogrifier.fix_object(new_data),
|
||||
data <- maybe_reinject_internal_fields(object, new_data),
|
||||
changeset <- Object.change(object, %{data: data}),
|
||||
changeset <- touch_changeset(changeset),
|
||||
{:ok, object} <- Repo.insert_or_update(changeset),
|
||||
{:ok, object} <- Object.set_cache(object) do
|
||||
defp reinject_object(_, new_data) do
|
||||
with {:ok, object, _} <- Pipeline.common_pipeline(new_data, local: false) do
|
||||
{:ok, object}
|
||||
else
|
||||
e ->
|
||||
Logger.error("Error while processing object: #{inspect(e)}")
|
||||
{:error, e}
|
||||
e -> e
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -5,6 +5,9 @@
|
||||
defmodule Pleroma.Object.Updater do
|
||||
require Pleroma.Constants
|
||||
|
||||
alias Pleroma.Object
|
||||
alias Pleroma.Repo
|
||||
|
||||
def update_content_fields(orig_object_data, updated_object) do
|
||||
Pleroma.Constants.status_updatable_fields()
|
||||
|> Enum.reduce(
|
||||
@ -237,4 +240,49 @@ defmodule Pleroma.Object.Updater do
|
||||
{:history_items, e} -> e
|
||||
end
|
||||
end
|
||||
|
||||
defp maybe_touch_changeset(changeset, true) do
|
||||
updated_at =
|
||||
NaiveDateTime.utc_now()
|
||||
|> NaiveDateTime.truncate(:second)
|
||||
|
||||
Ecto.Changeset.put_change(changeset, :updated_at, updated_at)
|
||||
end
|
||||
|
||||
defp maybe_touch_changeset(changeset, _), do: changeset
|
||||
|
||||
def do_update_and_invalidate_cache(orig_object, updated_object, touch_changeset? \\ false) do
|
||||
orig_object_ap_id = updated_object["id"]
|
||||
orig_object_data = orig_object.data
|
||||
|
||||
%{
|
||||
updated_data: updated_object_data,
|
||||
updated: updated,
|
||||
used_history_in_new_object?: used_history_in_new_object?
|
||||
} = make_new_object_data_from_update_object(orig_object_data, updated_object)
|
||||
|
||||
changeset =
|
||||
orig_object
|
||||
|> Repo.preload(:hashtags)
|
||||
|> Object.change(%{data: updated_object_data})
|
||||
|> maybe_touch_changeset(touch_changeset?)
|
||||
|
||||
with {:ok, new_object} <- Repo.update(changeset),
|
||||
{:ok, _} <- Object.invalid_object_cache(new_object),
|
||||
{:ok, _} <- Object.set_cache(new_object),
|
||||
# The metadata/utils.ex uses the object id for the cache.
|
||||
{:ok, _} <- Pleroma.Activity.HTML.invalidate_cache_for(new_object.id) do
|
||||
if used_history_in_new_object? do
|
||||
with create_activity when not is_nil(create_activity) <-
|
||||
Pleroma.Activity.get_create_by_object_ap_id(orig_object_ap_id),
|
||||
{:ok, _} <- Pleroma.Activity.HTML.invalidate_cache_for(create_activity.id) do
|
||||
nil
|
||||
else
|
||||
_ -> nil
|
||||
end
|
||||
end
|
||||
|
||||
{:ok, new_object, updated}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -68,6 +68,12 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator do
|
||||
|> validate_required([:type, :name, :icon])
|
||||
end
|
||||
|
||||
def changeset(struct, %{"type" => _} = data) do
|
||||
struct
|
||||
|> cast(data, [])
|
||||
|> Map.put(:action, :ignore)
|
||||
end
|
||||
|
||||
def icon_changeset(struct, data) do
|
||||
struct
|
||||
|> cast(data, [:type, :url])
|
||||
|
@ -428,37 +428,13 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
||||
end
|
||||
|
||||
if orig_object_data["type"] in Pleroma.Constants.updatable_object_types() do
|
||||
%{
|
||||
updated_data: updated_object_data,
|
||||
updated: updated,
|
||||
used_history_in_new_object?: used_history_in_new_object?
|
||||
} = Object.Updater.make_new_object_data_from_update_object(orig_object_data, updated_object)
|
||||
{:ok, _, updated} =
|
||||
Object.Updater.do_update_and_invalidate_cache(orig_object, updated_object)
|
||||
|
||||
changeset =
|
||||
orig_object
|
||||
|> Repo.preload(:hashtags)
|
||||
|> Object.change(%{data: updated_object_data})
|
||||
|
||||
with {:ok, new_object} <- Repo.update(changeset),
|
||||
{:ok, _} <- Object.invalid_object_cache(new_object),
|
||||
{:ok, _} <- Object.set_cache(new_object),
|
||||
# The metadata/utils.ex uses the object id for the cache.
|
||||
{:ok, _} <- Pleroma.Activity.HTML.invalidate_cache_for(new_object.id) do
|
||||
if used_history_in_new_object? do
|
||||
with create_activity when not is_nil(create_activity) <-
|
||||
Pleroma.Activity.get_create_by_object_ap_id(orig_object_ap_id),
|
||||
{:ok, _} <- Pleroma.Activity.HTML.invalidate_cache_for(create_activity.id) do
|
||||
nil
|
||||
else
|
||||
_ -> nil
|
||||
end
|
||||
end
|
||||
|
||||
if updated do
|
||||
object
|
||||
|> Activity.normalize()
|
||||
|> ActivityPub.notify_and_stream()
|
||||
end
|
||||
if updated do
|
||||
object
|
||||
|> Activity.normalize()
|
||||
|> ActivityPub.notify_and_stream()
|
||||
end
|
||||
end
|
||||
|
||||
|
82
lib/pleroma/web/api_spec/scopes/compiler.ex
Normal file
82
lib/pleroma/web/api_spec/scopes/compiler.ex
Normal file
@ -0,0 +1,82 @@
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.ApiSpec.Scopes.Compiler do
|
||||
defmacro __before_compile__(_env) do
|
||||
strings = __MODULE__.extract_all_scopes()
|
||||
|
||||
quote do
|
||||
def placeholder do
|
||||
unquote do
|
||||
Enum.map(
|
||||
strings,
|
||||
fn string ->
|
||||
quote do
|
||||
Pleroma.Web.Gettext.dgettext_noop(
|
||||
"oauth_scopes",
|
||||
unquote(string)
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def extract_all_scopes do
|
||||
extract_all_scopes_from(Pleroma.Web.ApiSpec.spec())
|
||||
end
|
||||
|
||||
def extract_all_scopes_from(specs) do
|
||||
specs.paths
|
||||
|> Enum.reduce([], fn
|
||||
{_path, %{} = path_item}, acc ->
|
||||
extract_routes(path_item)
|
||||
|> Enum.flat_map(fn operation -> process_operation(operation) end)
|
||||
|> Kernel.++(acc)
|
||||
|
||||
{_, _}, acc ->
|
||||
acc
|
||||
end)
|
||||
|> Enum.uniq()
|
||||
end
|
||||
|
||||
defp extract_routes(path_item) do
|
||||
path_item
|
||||
|> Map.from_struct()
|
||||
|> Enum.map(fn {_method, path_item} -> path_item end)
|
||||
|> Enum.filter(fn
|
||||
%OpenApiSpex.Operation{} = _operation -> true
|
||||
_ -> false
|
||||
end)
|
||||
end
|
||||
|
||||
defp process_operation(operation) do
|
||||
operation.security
|
||||
|> Kernel.||([])
|
||||
|> Enum.flat_map(fn
|
||||
%{"oAuth" => scopes} -> process_scopes(scopes)
|
||||
_ -> []
|
||||
end)
|
||||
end
|
||||
|
||||
defp process_scopes(scopes) do
|
||||
scopes
|
||||
|> Enum.flat_map(fn scope ->
|
||||
process_scope(scope)
|
||||
end)
|
||||
end
|
||||
|
||||
def process_scope(scope) do
|
||||
hierarchy = String.split(scope, ":")
|
||||
|
||||
{_, list} =
|
||||
Enum.reduce(hierarchy, {"", []}, fn comp, {cur, list} ->
|
||||
{cur <> comp <> ":", [cur <> comp | list]}
|
||||
end)
|
||||
|
||||
list
|
||||
end
|
||||
end
|
10
lib/pleroma/web/api_spec/scopes/translator.ex
Normal file
10
lib/pleroma/web/api_spec/scopes/translator.ex
Normal file
@ -0,0 +1,10 @@
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.ApiSpec.Scopes.Translator do
|
||||
require Pleroma.Web.ApiSpec.Scopes.Compiler
|
||||
require Pleroma.Web.Gettext
|
||||
|
||||
@before_compile Pleroma.Web.ApiSpec.Scopes.Compiler
|
||||
end
|
@ -8,7 +8,7 @@
|
||||
<%= checkbox @form, :"scope_#{scope}", value: scope in @scopes && scope, checked_value: scope, unchecked_value: "", name: "authorization[scope][]" %>
|
||||
<%= label @form, :"scope_#{scope}", String.capitalize(scope) %>
|
||||
<%= if scope in @scopes && scope do %>
|
||||
<%= String.capitalize(scope) %>
|
||||
<code><%= scope %></code> <%= :"Elixir.Gettext".dgettext(Gettext, "oauth_scopes", scope) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
|
264
priv/gettext/en/LC_MESSAGES/oauth_scopes.po
Normal file
264
priv/gettext/en/LC_MESSAGES/oauth_scopes.po
Normal file
@ -0,0 +1,264 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR Free Software Foundation, Inc.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"PO-Revision-Date: 2023-05-02 17:02-0400\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin"
|
||||
msgstr "All admin access"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read"
|
||||
msgstr "Read all using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write"
|
||||
msgstr "Write all using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "follow"
|
||||
msgstr "Read and write user relationships"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "push"
|
||||
msgstr "Push notifications"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read"
|
||||
msgstr "Read everything"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:accounts"
|
||||
msgstr "Read information of all accounts"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:backups"
|
||||
msgstr "Read your backups"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:blocks"
|
||||
msgstr "Read block relationships"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:bookmarks"
|
||||
msgstr "Read your bookmarks"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:chats"
|
||||
msgstr "Read your chats"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:favourites"
|
||||
msgstr "Read your favourites"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:filters"
|
||||
msgstr "Read your filtering settings"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:follows"
|
||||
msgstr "Read follow relationships"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:lists"
|
||||
msgstr "Read your lists"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:notifications"
|
||||
msgstr "Read your notifications"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:reports"
|
||||
msgstr "Read your reports"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:search"
|
||||
msgstr "Perform searches"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:statuses"
|
||||
msgstr "Read all statuses you can see"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write"
|
||||
msgstr "Write everything"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:accounts"
|
||||
msgstr "Change your account information"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:blocks"
|
||||
msgstr "Block or unblock someone"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:bookmarks"
|
||||
msgstr "Add to or remove from your bookmarks"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:chats"
|
||||
msgstr "Create or delete chats or chat messages, or mark them as read"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:conversations"
|
||||
msgstr "Change recipients of, mark as read, or delete conversations"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:favourites"
|
||||
msgstr "Favourite or unfavourite statuses"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:filters"
|
||||
msgstr "Change your filtering settings"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:follow"
|
||||
msgstr "Follow or unfollow someone"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:follows"
|
||||
msgstr "Follow or unfollow someone"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:lists"
|
||||
msgstr "Create, change or delete your lists"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:media"
|
||||
msgstr "Upload media files or modify those you uploaded"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:mutes"
|
||||
msgstr "Mute or unmute someone"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:notifications"
|
||||
msgstr "Mark notifications as read"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:reports"
|
||||
msgstr "Submit reports"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:statuses"
|
||||
msgstr "Post, edit, reblog or react to statuses"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:accounts"
|
||||
msgstr "Read all accounts using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:chats"
|
||||
msgstr "Read all chats using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:invites"
|
||||
msgstr "Read all invites using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:media_proxy_caches"
|
||||
msgstr "Read media proxy caches using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:reports"
|
||||
msgstr "Read all reports using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:statuses"
|
||||
msgstr "Read all statuses using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:accounts"
|
||||
msgstr "Change all accounts using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:chats"
|
||||
msgstr "Change all chats using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:follows"
|
||||
msgstr "Change follow relationships using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:invites"
|
||||
msgstr "Invite or revoke an invite using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:media_proxy_caches"
|
||||
msgstr "Change media proxy caches using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:reports"
|
||||
msgstr "Handle reports using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:statuses"
|
||||
msgstr "Delete, change scope of, or mark as sensitive statuses using admin API"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:media"
|
||||
msgstr "Read media attachments"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:mutes"
|
||||
msgstr "Read mute relationships"
|
261
priv/gettext/oauth_scopes.pot
Normal file
261
priv/gettext/oauth_scopes.pot
Normal file
@ -0,0 +1,261 @@
|
||||
## This file is a PO Template file.
|
||||
##
|
||||
## "msgid"s here are often extracted from source code.
|
||||
## Add new translations manually only if they're dynamic
|
||||
## translations that can't be statically extracted.
|
||||
##
|
||||
## Run "mix gettext.extract" to bring this file up to
|
||||
## date. Leave "msgstr"s empty as changing them here has no
|
||||
## effect: edit them in PO (.po) files instead.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "follow"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "push"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:accounts"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:backups"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:blocks"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:bookmarks"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:chats"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:favourites"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:filters"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:follows"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:lists"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:notifications"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:reports"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:search"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:statuses"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:accounts"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:blocks"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:bookmarks"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:chats"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:conversations"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:favourites"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:filters"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:follow"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:follows"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:lists"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:media"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:mutes"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:notifications"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:reports"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "write:statuses"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:accounts"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:chats"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:invites"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:media_proxy_caches"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:reports"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:read:statuses"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:accounts"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:chats"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:follows"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:invites"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:media_proxy_caches"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:reports"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "admin:write:statuses"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:media"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/pleroma/web/api_spec/scopes/translator.ex:5
|
||||
msgid "read:mutes"
|
||||
msgstr ""
|
@ -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(:a, ["name", "title", "lang"])
|
||||
|
||||
Meta.allow_tag_with_these_attributes(:abbr, ["title"])
|
||||
Meta.allow_tag_with_these_attributes(:abbr, ["title", "lang"])
|
||||
|
||||
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(: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()
|
||||
|
31
test/fixtures/fep-e232.json
vendored
Normal file
31
test/fixtures/fep-e232.json
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"type": "Create",
|
||||
"actor": "https://example.org/users/alice",
|
||||
"object": {
|
||||
"id": "https://example.org/objects/10",
|
||||
"type": "Note",
|
||||
"attributedTo": "https://example.org/users/alice",
|
||||
"content": "<p>test <a href=\"https://example.org/objects/9\">https://example.org/objects/9</a></p>",
|
||||
"published": "2022-10-01T21:30:05.211215Z",
|
||||
"tag": [
|
||||
{
|
||||
"name": "@bob@example.net",
|
||||
"type": "Mention",
|
||||
"href": "https://example.net/users/bob"
|
||||
},
|
||||
{
|
||||
"name": "https://example.org/objects/9",
|
||||
"type": "Link",
|
||||
"href": "https://example.org/objects/9",
|
||||
"mediaType": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
|
||||
}
|
||||
],
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"https://example.org/users/alice/followers"
|
||||
]
|
||||
}
|
||||
}
|
@ -9,8 +9,12 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
alias Pleroma.Instances
|
||||
alias Pleroma.Object
|
||||
alias Pleroma.Object.Fetcher
|
||||
alias Pleroma.Web.ActivityPub.ObjectValidator
|
||||
|
||||
require Pleroma.Constants
|
||||
|
||||
import Mock
|
||||
import Pleroma.Factory
|
||||
import Tesla.Mock
|
||||
|
||||
setup do
|
||||
@ -284,6 +288,8 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
|
||||
describe "refetching" do
|
||||
setup do
|
||||
insert(:user, ap_id: "https://mastodon.social/users/emelie")
|
||||
|
||||
object1 = %{
|
||||
"id" => "https://mastodon.social/1",
|
||||
"actor" => "https://mastodon.social/users/emelie",
|
||||
@ -293,10 +299,14 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
"bcc" => [],
|
||||
"bto" => [],
|
||||
"cc" => [],
|
||||
"to" => [],
|
||||
"summary" => ""
|
||||
"to" => [Pleroma.Constants.as_public()],
|
||||
"summary" => "",
|
||||
"published" => "2023-05-08 23:43:20Z",
|
||||
"updated" => "2023-05-09 23:43:20Z"
|
||||
}
|
||||
|
||||
{:ok, local_object1, _} = ObjectValidator.validate(object1, [])
|
||||
|
||||
object2 = %{
|
||||
"id" => "https://mastodon.social/2",
|
||||
"actor" => "https://mastodon.social/users/emelie",
|
||||
@ -306,8 +316,10 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
"bcc" => [],
|
||||
"bto" => [],
|
||||
"cc" => [],
|
||||
"to" => [],
|
||||
"to" => [Pleroma.Constants.as_public()],
|
||||
"summary" => "",
|
||||
"published" => "2023-05-08 23:43:20Z",
|
||||
"updated" => "2023-05-09 23:43:25Z",
|
||||
"formerRepresentations" => %{
|
||||
"type" => "OrderedCollection",
|
||||
"orderedItems" => [
|
||||
@ -319,14 +331,18 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
"bcc" => [],
|
||||
"bto" => [],
|
||||
"cc" => [],
|
||||
"to" => [],
|
||||
"summary" => ""
|
||||
"to" => [Pleroma.Constants.as_public()],
|
||||
"summary" => "",
|
||||
"published" => "2023-05-08 23:43:20Z",
|
||||
"updated" => "2023-05-09 23:43:21Z"
|
||||
}
|
||||
],
|
||||
"totalItems" => 1
|
||||
}
|
||||
}
|
||||
|
||||
{:ok, local_object2, _} = ObjectValidator.validate(object2, [])
|
||||
|
||||
mock(fn
|
||||
%{
|
||||
method: :get,
|
||||
@ -335,7 +351,7 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
%Tesla.Env{
|
||||
status: 200,
|
||||
headers: [{"content-type", "application/activity+json"}],
|
||||
body: Jason.encode!(object1)
|
||||
body: Jason.encode!(object1 |> Map.put("updated", "2023-05-09 23:44:20Z"))
|
||||
}
|
||||
|
||||
%{
|
||||
@ -345,7 +361,7 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
%Tesla.Env{
|
||||
status: 200,
|
||||
headers: [{"content-type", "application/activity+json"}],
|
||||
body: Jason.encode!(object2)
|
||||
body: Jason.encode!(object2 |> Map.put("updated", "2023-05-09 23:44:20Z"))
|
||||
}
|
||||
|
||||
%{
|
||||
@ -370,7 +386,7 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
apply(HttpRequestMock, :request, [env])
|
||||
end)
|
||||
|
||||
%{object1: object1, object2: object2}
|
||||
%{object1: local_object1, object2: local_object2}
|
||||
end
|
||||
|
||||
test "it keeps formerRepresentations if remote does not have this attr", %{object1: object1} do
|
||||
@ -388,8 +404,9 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
"bcc" => [],
|
||||
"bto" => [],
|
||||
"cc" => [],
|
||||
"to" => [],
|
||||
"summary" => ""
|
||||
"to" => [Pleroma.Constants.as_public()],
|
||||
"summary" => "",
|
||||
"published" => "2023-05-08 23:43:20Z"
|
||||
}
|
||||
],
|
||||
"totalItems" => 1
|
||||
@ -467,6 +484,53 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
}
|
||||
} = refetched.data
|
||||
end
|
||||
|
||||
test "it keeps the history intact if only updated time has changed",
|
||||
%{object1: object1} do
|
||||
full_object1 =
|
||||
object1
|
||||
|> Map.merge(%{
|
||||
"updated" => "2023-05-08 23:43:47Z",
|
||||
"formerRepresentations" => %{
|
||||
"type" => "OrderedCollection",
|
||||
"orderedItems" => [
|
||||
%{"type" => "Note", "content" => "mew mew 1"}
|
||||
],
|
||||
"totalItems" => 1
|
||||
}
|
||||
})
|
||||
|
||||
{:ok, o} = Object.create(full_object1)
|
||||
|
||||
assert {:ok, refetched} = Fetcher.refetch_object(o)
|
||||
|
||||
assert %{
|
||||
"content" => "test 1",
|
||||
"formerRepresentations" => %{
|
||||
"orderedItems" => [
|
||||
%{"content" => "mew mew 1"}
|
||||
],
|
||||
"totalItems" => 1
|
||||
}
|
||||
} = refetched.data
|
||||
end
|
||||
|
||||
test "it goes through ObjectValidator and MRF", %{object2: object2} do
|
||||
with_mock Pleroma.Web.ActivityPub.MRF, [:passthrough],
|
||||
filter: fn
|
||||
%{"type" => "Note"} = object ->
|
||||
{:ok, Map.put(object, "content", "MRFd content")}
|
||||
|
||||
arg ->
|
||||
passthrough([arg])
|
||||
end do
|
||||
{:ok, o} = Object.create(object2)
|
||||
|
||||
assert {:ok, refetched} = Fetcher.refetch_object(o)
|
||||
|
||||
assert %{"content" => "MRFd content"} = refetched.data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "fetch with history" do
|
||||
|
@ -123,6 +123,20 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||
|
||||
assert activity.data["context"] == object.data["context"]
|
||||
end
|
||||
|
||||
test "it drops link tags" do
|
||||
insert(:user, ap_id: "https://example.org/users/alice")
|
||||
|
||||
message = File.read!("test/fixtures/fep-e232.json") |> Jason.decode!()
|
||||
|
||||
assert {:ok, activity} = Transmogrifier.handle_incoming(message)
|
||||
|
||||
object = Object.normalize(activity)
|
||||
assert length(object.data["tag"]) == 1
|
||||
|
||||
tag = object.data["tag"] |> List.first()
|
||||
assert tag["type"] == "Mention"
|
||||
end
|
||||
end
|
||||
|
||||
describe "prepare outgoing" do
|
||||
|
56
test/pleroma/web/api_spec/scopes/compiler_test.exs
Normal file
56
test/pleroma/web/api_spec/scopes/compiler_test.exs
Normal file
@ -0,0 +1,56 @@
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.ApiSpec.Scopes.CompilerTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
alias Pleroma.Web.ApiSpec.Scopes.Compiler
|
||||
|
||||
@dummy_response %{}
|
||||
|
||||
@data %{
|
||||
paths: %{
|
||||
"/mew" => %OpenApiSpex.PathItem{
|
||||
post: %OpenApiSpex.Operation{
|
||||
security: [%{"oAuth" => ["a:b:c"]}],
|
||||
responses: @dummy_response
|
||||
},
|
||||
get: %OpenApiSpex.Operation{security: nil, responses: @dummy_response}
|
||||
},
|
||||
"/mew2" => %OpenApiSpex.PathItem{
|
||||
post: %OpenApiSpex.Operation{
|
||||
security: [%{"oAuth" => ["d:e", "f:g"]}],
|
||||
responses: @dummy_response
|
||||
},
|
||||
get: %OpenApiSpex.Operation{security: nil, responses: @dummy_response}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe "process_scope/1" do
|
||||
test "gives all higher-level scopes" do
|
||||
scopes = Compiler.process_scope("admin:read:accounts")
|
||||
|
||||
assert [_, _, _] = scopes
|
||||
assert "admin" in scopes
|
||||
assert "admin:read" in scopes
|
||||
assert "admin:read:accounts" in scopes
|
||||
end
|
||||
end
|
||||
|
||||
describe "extract_all_scopes_from/1" do
|
||||
test "extracts scopes" do
|
||||
scopes = Compiler.extract_all_scopes_from(@data)
|
||||
|
||||
assert [_, _, _, _, _, _, _] = scopes
|
||||
assert "a" in scopes
|
||||
assert "a:b" in scopes
|
||||
assert "a:b:c" in scopes
|
||||
assert "d" in scopes
|
||||
assert "d:e" in scopes
|
||||
assert "f" in scopes
|
||||
assert "f:g" in scopes
|
||||
end
|
||||
end
|
||||
end
|
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user