Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
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
kaniini
pleroma
Commits
f980f677
Commit
f980f677
authored
8 years ago
by
lain
Browse files
Options
Downloads
Patches
Plain Diff
Wire up mentions.
parent
b438ea24
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/pleroma/web/ostatus/ostatus.ex
+5
-16
5 additions, 16 deletions
lib/pleroma/web/ostatus/ostatus.ex
test/web/ostatus/ostatus_test.exs
+1
-0
1 addition, 0 deletions
test/web/ostatus/ostatus_test.exs
with
6 additions
and
16 deletions
lib/pleroma/web/ostatus/ostatus.ex
+
5
−
16
View file @
f980f677
...
...
@@ -31,10 +31,7 @@ defmodule Pleroma.Web.OStatus do
end
# TODO
# Parse mention
# wire up replies
# Set correct context
# Set correct statusnet ids.
def
handle_note
(
doc
)
do
content_html
=
string_from_xpath
(
"/entry/content[1]"
,
doc
)
...
...
@@ -52,6 +49,11 @@ defmodule Pleroma.Web.OStatus do
"https://www.w3.org/ns/activitystreams#Public"
]
mentions
=
:xmerl_xpath
.
string
(
'/entry/link[@rel="mentioned" and @ostatus:object-type="http://activitystrea.ms/schema/1.0/person"]'
,
doc
)
|>
Enum
.
map
(
fn
(
person
)
->
string_from_xpath
(
"@href"
,
person
)
end
)
to
=
to
++
mentions
date
=
string_from_xpath
(
"/entry/published"
,
doc
)
object
=
%{
...
...
@@ -66,19 +68,6 @@ defmodule Pleroma.Web.OStatus do
ActivityPub
.
create
(
to
,
actor
,
context
,
object
,
%{},
date
)
end
def
find_or_make
(
author
,
doc
)
do
query
=
from
user
in
User
,
where:
user
.
local
==
false
and
fragment
(
"? @> ?"
,
user
.
info
,
^
%{
ostatus_uri:
author
})
user
=
Repo
.
one
(
query
)
if
is_nil
(
user
)
do
make_user
(
doc
)
else
{
:ok
,
user
}
end
end
def
find_or_make_user
(
author_doc
)
do
{
:xmlObj
,
:string
,
uri
}
=
:xmerl_xpath
.
string
(
'string(/author[1]/uri)'
,
author_doc
)
...
...
This diff is collapsed.
Click to expand it.
test/web/ostatus/ostatus_test.exs
+
1
−
0
View file @
f980f677
...
...
@@ -10,6 +10,7 @@ defmodule Pleroma.Web.OStatusTest do
assert
activity
.
data
[
"object"
][
"type"
]
==
"Note"
assert
activity
.
data
[
"published"
]
==
"2017-04-23T14:51:03+00:00"
assert
activity
.
data
[
"context"
]
==
"tag:gs.example.org:4040,2017-04-23:objectType=thread:nonce=f09e22f58abd5c7b"
assert
"http://pleroma.example.org:4000/users/lain3"
in
activity
.
data
[
"to"
]
end
describe
"new remote user creation"
do
...
...
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