Compare commits

..

3 commits

Author SHA1 Message Date
ilja
ce517ff4e5 Fix tagpolicy to also work with Update
Objects who got updated would just pass the TagPolicy, undoing the moderation that was set in place for the Actor.
Now we check not only for Create activities, but also Update activities.
2022-12-08 21:53:42 +01:00
9addd8f414 Merge pull request 'Add YAML issue templates for bug and feat' (#353) from sfr/akkoma:issue-template into develop
Reviewed-on: AkkomaGang/akkoma#353
2022-12-08 18:40:45 +00:00
Sol Fisher Romanoff
067bd17e1e
Add YAML issue templates for bug and feat 2022-12-08 20:16:59 +02:00
5 changed files with 183 additions and 36 deletions

View file

@ -0,0 +1,85 @@
name: "Bug report"
about: "Something isn't working as expected"
title: "[bug] "
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to file this bug report! Please try to be as specific and detailed as you can, so we can track down the issue and fix it as soon as possible.
# General information
- type: dropdown
id: installation
attributes:
label: "Your setup"
description: "What sort of installation are you using?"
options:
- "OTP"
- "From source"
- "Docker"
validations:
required: true
- type: input
id: setup-details
attributes:
label: "Extra details"
description: "If installing from source or docker, please specify your distro or docker setup."
placeholder: "e.g. Alpine Linux edge"
- type: input
id: version
attributes:
label: "Version"
description: "Which version of Akkoma are you running? If running develop, specify the commit hash."
placeholder: "e.g. 2022.11, 4e4bd248"
- type: input
id: postgres
attributes:
label: "PostgreSQL version"
placeholder: "14"
validations:
required: true
- type: markdown
attributes:
value: "# The issue"
- type: textarea
id: attempt
attributes:
label: "What were you trying to do?"
validations:
required: true
- type: textarea
id: expectation
attributes:
label: "What did you expect to happen?"
validations:
required: true
- type: textarea
id: reality
attributes:
label: "What actually happened?"
validations:
required: true
- type: textarea
id: logs
attributes:
label: "Logs"
description: "Please copy and paste any relevant log output, if applicable."
render: shell
- type: dropdown
id: severity
attributes:
label: "Severity"
description: "Does this issue prevent you from using the software as normal?"
options:
- "I cannot use the software"
- "I cannot use it as easily as I'd like"
- "I can manage"
validations:
required: true
- type: checkboxes
id: searched
attributes:
label: "Have you searched for this issue?"
description: "Please double-check that your issue is not already being tracked on [the forums](https://meta.akkoma.dev) or [the issue tracker](https://akkoma.dev/AkkomaGang/akkoma/issues)."
options:
- label: "I have double-checked and have not found this issue mentioned anywhere."

View file

@ -0,0 +1,29 @@
name: "Feature request"
about: "I'd like something to be added to Akkoma"
title: "[feat] "
body:
- type: markdown
attributes:
value: "Thanks for taking the time to request a new feature! Please be as concise and clear as you can in your proposal, so we could understand what you're going for."
- type: textarea
id: idea
attributes:
label: "The idea"
description: "What do you think you should be able to do in Akkoma?"
validations:
required: true
- type: textarea
id: reason
attributes:
label: "The reasoning"
description: "Why would this be a worthwhile feature? Does it solve any problems? Have people talked about wanting it?"
validations:
required: true
- type: checkboxes
id: searched
attributes:
label: "Have you searched for this feature request?"
description: "Please double-check that your issue is not already being tracked on [the forums](https://meta.akkoma.dev), [the issue tracker](https://akkoma.dev/AkkomaGang/akkoma/issues), or the one for [pleroma-fe](https://akkoma.dev/AkkomaGang/pleroma-fe/issues)."
options:
- label: "I have double-checked and have not found this feature request mentioned anywhere."
- label: "This feature is related to the Akkoma backend specifically, and not pleroma-fe."

View file

@ -1,27 +0,0 @@
---
name: "Issue"
about: "Something isn't working as expected"
---
## Your setup
[] OTP
[] From Source
[] Distro:
[] Docker (what setup?)
Postgres version:
## What were you trying to do?
## What did you expect to happen?
## What actually happened?
## Relative severity (does this prevent you from using the software as normal?)
[] I cannot use the software
[] I cannot use it as easily as I'd like
[] I can manage

View file

@ -27,22 +27,22 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do
defp process_tag(
"mrf_tag:media-force-nsfw",
%{
"type" => "Create",
"type" => type,
"object" => %{"attachment" => child_attachment}
} = message
)
when length(child_attachment) > 0 do
when length(child_attachment) > 0 and type in ["Create", "Update"] do
{:ok, Kernel.put_in(message, ["object", "sensitive"], true)}
end
defp process_tag(
"mrf_tag:media-strip",
%{
"type" => "Create",
"type" => type,
"object" => %{"attachment" => child_attachment} = object
} = message
)
when length(child_attachment) > 0 do
when length(child_attachment) > 0 and type in ["Create", "Update"] do
object = Map.delete(object, "attachment")
message = Map.put(message, "object", object)
@ -52,13 +52,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do
defp process_tag(
"mrf_tag:force-unlisted",
%{
"type" => "Create",
"type" => type,
"to" => to,
"cc" => cc,
"actor" => actor,
"object" => object
} = message
) do
) when type in ["Create", "Update"] do
user = User.get_cached_by_ap_id(actor)
if Enum.member?(to, Pleroma.Constants.as_public()) do
@ -85,13 +85,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do
defp process_tag(
"mrf_tag:sandbox",
%{
"type" => "Create",
"type" => type,
"to" => to,
"cc" => cc,
"actor" => actor,
"object" => object
} = message
) do
) when type in ["Create", "Update"] do
user = User.get_cached_by_ap_id(actor)
if Enum.member?(to, Pleroma.Constants.as_public()) or
@ -152,7 +152,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do
do: filter_message(target_actor, message)
@impl true
def filter(%{"actor" => actor, "type" => "Create"} = message),
def filter(%{"actor" => actor, "type" => type} = message) when type in ["Create", "Update"],
do: filter_message(actor, message)
@impl true

View file

@ -53,7 +53,24 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicyTest do
"cc" => ["d"]
}
edit_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{},
"to" => [@public, "f"],
"cc" => [@public, "d"]
}
edit_expect_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{"to" => ["f", actor.follower_address], "cc" => ["d"]},
"to" => ["f", actor.follower_address],
"cc" => ["d"]
}
assert TagPolicy.filter(message) == {:ok, except_message}
assert TagPolicy.filter(edit_message) == {:ok, edit_expect_message}
end
end
@ -77,7 +94,24 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicyTest do
"cc" => ["d", @public]
}
edit_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{},
"to" => [@public, "f"],
"cc" => [actor.follower_address, "d"]
}
edit_expect_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{"to" => ["f", actor.follower_address], "cc" => ["d", @public]},
"to" => ["f", actor.follower_address],
"cc" => ["d", @public]
}
assert TagPolicy.filter(message) == {:ok, except_message}
assert TagPolicy.filter(edit_message) == {:ok, edit_expect_message}
end
end
@ -97,7 +131,20 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicyTest do
"object" => %{}
}
edit_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{"attachment" => ["file1"]}
}
edit_expect_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{}
}
assert TagPolicy.filter(message) == {:ok, except_message}
assert TagPolicy.filter(edit_message) == {:ok, edit_expect_message}
end
end
@ -117,7 +164,20 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicyTest do
"object" => %{"tag" => ["test"], "attachment" => ["file1"], "sensitive" => true}
}
edit_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{"tag" => ["test"], "attachment" => ["file1"]}
}
edit_expect_message = %{
"actor" => actor.ap_id,
"type" => "Update",
"object" => %{"tag" => ["test"], "attachment" => ["file1"], "sensitive" => true}
}
assert TagPolicy.filter(message) == {:ok, except_message}
assert TagPolicy.filter(edit_message) == {:ok, edit_expect_message}
end
end
end