Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
c62220c5
Commit
c62220c5
authored
Mar 23, 2019
by
kaniini
Browse files
rich media: helpers: only crawl Create activities
parent
9a06d9f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/rich_media/helpers.ex
View file @
c62220c5
...
...
@@ -21,7 +21,7 @@ defp validate_page_url(%URI{scheme: nil}), do: :error
defp
validate_page_url
(%
URI
{}),
do
:
:ok
defp
validate_page_url
(
_
),
do
:
:error
def
fetch_data_for_activity
(%
Activity
{}
=
activity
)
do
def
fetch_data_for_activity
(%
Activity
{
data:
%{
"type"
=>
"Create"
}
}
=
activity
)
do
with
true
<-
Pleroma
.
Config
.
get
([
:rich_media
,
:enabled
]),
%
Object
{}
=
object
<-
Object
.
normalize
(
activity
),
{
:ok
,
page_url
}
<-
HTML
.
extract_first_external_url
(
object
,
object
.
data
[
"content"
]),
...
...
@@ -32,4 +32,6 @@ def fetch_data_for_activity(%Activity{} = activity) do
_
->
%{}
end
end
def
fetch_data_for_activity
(
_
),
do
:
%{}
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment