Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alex Gleason
pleroma
Commits
e67cde0e
Commit
e67cde0e
authored
4 years ago
by
lain
Browse files
Options
Downloads
Patches
Plain Diff
Transmogrifier: Refactoring / Renaming.
parent
037b49c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/pleroma/web/activity_pub/transmogrifier.ex
+8
-8
8 additions, 8 deletions
lib/pleroma/web/activity_pub/transmogrifier.ex
with
8 additions
and
8 deletions
lib/pleroma/web/activity_pub/transmogrifier.ex
+
8
−
8
View file @
e67cde0e
...
...
@@ -617,9 +617,9 @@ def handle_incoming(%{"type" => "Like"} = data, _options) do
data
|>
LikeValidator
.
cast_data
()
|>
Ecto
.
Changeset
.
apply_action
(
:insert
)},
cast_data
=
ObjectValidator
.
stringify_keys
(
Map
.
from_struct
(
cast_data_sym
)),
:ok
<-
ObjectValidator
.
fetch_actor_and_object
(
cast_data
),
{
_
,
{
:ok
,
cast_data
}}
<-
{
:
maybe_add_context
,
maybe_add_context_from_object
(
cast_data
)},
{
_
,
{
:ok
,
cast_data
}}
<-
{
:
ensure_context_presence
,
ensure_context_presence
(
cast_data
)},
{
_
,
{
:ok
,
cast_data
}}
<-
{
:
maybe_add
_recipients
,
maybe_add
_recipients_
from_object
(
cast_data
)},
{
:
ensure
_recipients
_presence
,
ensure
_recipients_
presence
(
cast_data
)},
{
_
,
{
:ok
,
activity
,
_meta
}}
<-
{
:common_pipeline
,
Pipeline
.
common_pipeline
(
cast_data
,
local:
false
)}
do
{
:ok
,
activity
}
...
...
@@ -1251,10 +1251,10 @@ def maybe_fix_user_url(data), do: data
def
maybe_fix_user_object
(
data
),
do
:
maybe_fix_user_url
(
data
)
defp
maybe_add_context_from_object
(%{
"context"
=>
context
}
=
data
)
when
is_binary
(
context
),
defp
ensure_context_presence
(%{
"context"
=>
context
}
=
data
)
when
is_binary
(
context
),
do
:
{
:ok
,
data
}
defp
maybe_add_context_from_object
(%{
"object"
=>
object
}
=
data
)
when
is_binary
(
object
)
do
defp
ensure_context_presence
(%{
"object"
=>
object
}
=
data
)
when
is_binary
(
object
)
do
with
%{
data:
%{
"context"
=>
context
}}
when
is_binary
(
context
)
<-
Object
.
normalize
(
object
)
do
{
:ok
,
Map
.
put
(
data
,
"context"
,
context
)}
else
...
...
@@ -1263,14 +1263,14 @@ defp maybe_add_context_from_object(%{"object" => object} = data) when is_binary(
end
end
defp
maybe_add_context_from_object
(
_
)
do
defp
ensure_context_presence
(
_
)
do
{
:error
,
:no_context
}
end
defp
maybe_add
_recipients_
from_object
(%{
"to"
=>
[
_
|
_
],
"cc"
=>
[
_
|
_
]}
=
data
),
defp
ensure
_recipients_
presence
(%{
"to"
=>
[
_
|
_
],
"cc"
=>
[
_
|
_
]}
=
data
),
do
:
{
:ok
,
data
}
defp
maybe_add
_recipients_
from_object
(%{
"object"
=>
object
}
=
data
)
do
defp
ensure
_recipients_
presence
(%{
"object"
=>
object
}
=
data
)
do
case
Object
.
normalize
(
object
)
do
%{
data:
%{
"actor"
=>
actor
}}
->
data
=
...
...
@@ -1288,7 +1288,7 @@ defp maybe_add_recipients_from_object(%{"object" => object} = data) do
end
end
defp
maybe_add
_recipients_
from_object
(
_
)
do
defp
ensure
_recipients_
presence
(
_
)
do
{
:error
,
:no_object
}
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment