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
b76001de
Commit
b76001de
authored
Jun 20, 2017
by
dtluna
Browse files
Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into develop
parents
08e53df9
07cee92c
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/activity.ex
View file @
b76001de
...
...
@@ -12,16 +12,17 @@ defmodule Pleroma.Activity do
def
get_by_ap_id
(
ap_id
)
do
Repo
.
one
(
from
activity
in
Activity
,
where:
fragment
(
"
? @>
?"
,
activity
.
data
,
^
%{
id:
ap_id
}
))
where:
fragment
(
"
(?)->>'id' =
?"
,
activity
.
data
,
^
to_string
(
ap_id
)
))
end
def
all_by_object_ap_id
(
ap_id
)
do
Repo
.
all
(
from
activity
in
Activity
,
where:
fragment
(
"
? @>
?"
,
activity
.
data
,
^
%{
object:
%{
id:
ap_id
}}
))
where:
fragment
(
"
(?)->'object'->>'id' =
?"
,
activity
.
data
,
^
to_string
(
ap_id
)
))
end
def
get_create_activity_by_object_ap_id
(
ap_id
)
do
Repo
.
one
(
from
activity
in
Activity
,
where:
fragment
(
"? @> ?"
,
activity
.
data
,
^
%{
type:
"Create"
,
object:
%{
id:
ap_id
}}))
where:
fragment
(
"(?)->'object'->>'id' = ?"
,
activity
.
data
,
^
to_string
(
ap_id
))
and
fragment
(
"(?)->>'type' = 'Create'"
,
activity
.
data
))
end
end
lib/pleroma/web/websub/websub.ex
View file @
b76001de
...
...
@@ -53,10 +53,14 @@ def publish(topic, user, activity) do
Logger
.
debug
(
fn
->
"Pushing to
#{
sub
.
callback
}
"
end
)
Task
.
start
(
fn
->
@httpoison
.
post
(
sub
.
callback
,
response
,
[
with
{
:ok
,
%{
status_code:
code
}}
<-
@httpoison
.
post
(
sub
.
callback
,
response
,
[
{
"Content-Type"
,
"application/atom+xml"
},
{
"X-Hub-Signature"
,
"sha1=
#{
signature
}
"
}
])
])
do
Logger
.
debug
(
fn
->
"Pushed to
#{
sub
.
callback
}
, code
#{
code
}
"
end
)
else
e
->
Logger
.
debug
(
fn
->
"Couldn't push to
#{
sub
.
callback
}
,
#{
inspect
(
e
)
}
"
end
)
end
end
)
end
)
end
...
...
priv/repo/migrations/20170620133028_add_object_activity_index.exs
0 → 100644
View file @
b76001de
defmodule
Pleroma
.
Repo
.
Migrations
.
AddObjectActivityIndex
do
use
Ecto
.
Migration
def
change
do
create
index
(
:objects
,
[
"(data->'object'->>'id')"
,
"(data->>'type')"
],
name:
:activities_create_objects_index
)
end
end
priv/repo/migrations/20170620142420_add_object_activity_index_part_two.exs
0 → 100644
View file @
b76001de
defmodule
Pleroma
.
Repo
.
Migrations
.
AddObjectActivityIndexPartTwo
do
use
Ecto
.
Migration
def
change
do
drop
index
(
:objects
,
[
"(data->'object'->>'id')"
,
"(data->>'type')"
],
name:
:activities_create_objects_index
)
create
index
(
:activities
,
[
"(data->'object'->>'id')"
,
"(data->>'type')"
],
name:
:activities_create_objects_index
)
end
end
Write
Preview
Markdown
is supported
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