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
9d97be44
Commit
9d97be44
authored
May 19, 2017
by
lain
Browse files
Try fetching shares.
parent
03b7b2fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/ostatus/ostatus.ex
View file @
9d97be44
...
...
@@ -63,8 +63,7 @@ def make_share(entry, doc, retweeted_activity) do
end
def
handle_share
(
entry
,
doc
)
do
with
[
object
]
<-
:xmerl_xpath
.
string
(
'/entry/activity:object'
,
entry
),
{
:ok
,
retweeted_activity
}
<-
handle_note
(
object
,
object
),
with
{
:ok
,
retweeted_activity
}
<-
get_or_build_object
(
entry
),
{
:ok
,
activity
}
<-
make_share
(
entry
,
doc
,
retweeted_activity
)
do
{
:ok
,
activity
,
retweeted_activity
}
else
...
...
@@ -81,6 +80,18 @@ def make_favorite(entry, doc, favorited_activity) do
end
end
def
get_or_build_object
(
entry
)
do
with
{
:ok
,
activity
}
<-
get_or_try_fetching
(
entry
)
do
{
:ok
,
activity
}
else
_e
->
with
[
object
]
<-
:xmerl_xpath
.
string
(
'/entry/activity:object'
,
entry
)
do
handle_note
(
object
,
object
)
end
end
end
def
get_or_try_fetching
(
entry
)
do
Logger
.
debug
(
"Trying to get entry from db"
)
with
id
when
not
is_nil
(
id
)
<-
string_from_xpath
(
"//activity:object[1]/id"
,
entry
),
...
...
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