Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hakaba Hitoyo
pleroma
Commits
98c8184c
Verified
Commit
98c8184c
authored
Jan 21, 2019
by
Haelwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Activity: get_create_activity_by_object_ap_id/1 → get_create_by_object_ap_id/1
parent
2fdbd4d1
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
48 additions
and
49 deletions
+48
-49
lib/pleroma/activity.ex
lib/pleroma/activity.ex
+14
-13
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
+2
-2
lib/pleroma/web/common_api/utils.ex
lib/pleroma/web/common_api/utils.ex
+2
-2
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+5
-6
lib/pleroma/web/mastodon_api/views/status_view.ex
lib/pleroma/web/mastodon_api/views/status_view.ex
+2
-2
lib/pleroma/web/ostatus/activity_representer.ex
lib/pleroma/web/ostatus/activity_representer.ex
+1
-1
lib/pleroma/web/ostatus/handlers/note_handler.ex
lib/pleroma/web/ostatus/handlers/note_handler.ex
+2
-2
lib/pleroma/web/ostatus/ostatus.ex
lib/pleroma/web/ostatus/ostatus.ex
+1
-1
lib/pleroma/web/ostatus/ostatus_controller.ex
lib/pleroma/web/ostatus/ostatus_controller.ex
+1
-2
lib/pleroma/web/twitter_api/twitter_api.ex
lib/pleroma/web/twitter_api/twitter_api.ex
+4
-4
lib/pleroma/web/twitter_api/twitter_api_controller.ex
lib/pleroma/web/twitter_api/twitter_api_controller.ex
+2
-2
lib/pleroma/web/twitter_api/views/activity_view.ex
lib/pleroma/web/twitter_api/views/activity_view.ex
+2
-2
test/activity_test.exs
test/activity_test.exs
+1
-1
test/web/activity_pub/activity_pub_test.exs
test/web/activity_pub/activity_pub_test.exs
+3
-3
test/web/activity_pub/transmogrifier_test.exs
test/web/activity_pub/transmogrifier_test.exs
+3
-3
test/web/mastodon_api/status_view_test.exs
test/web/mastodon_api/status_view_test.exs
+1
-1
test/web/twitter_api/twitter_api_test.exs
test/web/twitter_api/twitter_api_test.exs
+1
-1
test/web/twitter_api/views/activity_view_test.exs
test/web/twitter_api/views/activity_view_test.exs
+1
-1
No files found.
lib/pleroma/activity.ex
View file @
98c8184c
...
...
@@ -36,7 +36,7 @@ def get_by_ap_id(ap_id) do
)
end
def
create_
by_object_ap_id
(
ap_id
)
do
def
by_object_ap_id
(
ap_id
)
do
from
(
activity
in
Activity
,
where:
...
...
@@ -45,33 +45,34 @@ def create_by_object_ap_id(ap_id) do
activity
.
data
,
activity
.
data
,
^
to_string
(
ap_id
)
),
where:
fragment
(
"(?)->>'type' = 'Create'"
,
activity
.
data
)
)
)
end
def
by_object_ap_id
(
ap_id
)
do
def
create_by_object_ap_id
(
ap_ids
)
when
is_list
(
ap_ids
)
do
from
(
activity
in
Activity
,
where:
fragment
(
"coalesce((?)->'object'->>'id', (?)->>'object') =
?
"
,
"coalesce((?)->'object'->>'id', (?)->>'object') =
ANY(?)
"
,
activity
.
data
,
activity
.
data
,
^
to_string
(
ap_id
)
)
^
ap_ids
),
where:
fragment
(
"(?)->>'type' = 'Create'"
,
activity
.
data
)
)
end
def
create_by_object_ap_id
(
ap_id
s
)
when
is_list
(
ap_ids
)
do
def
create_by_object_ap_id
(
ap_id
)
do
from
(
activity
in
Activity
,
where:
fragment
(
"coalesce((?)->'object'->>'id', (?)->>'object') =
ANY(?)
"
,
"coalesce((?)->'object'->>'id', (?)->>'object') =
?
"
,
activity
.
data
,
activity
.
data
,
^
ap_ids
^
to_string
(
ap_id
)
),
where:
fragment
(
"(?)->>'type' = 'Create'"
,
activity
.
data
)
)
...
...
@@ -81,19 +82,19 @@ def get_all_create_by_object_ap_id(ap_id) do
Repo
.
all
(
create_by_object_ap_id
(
ap_id
))
end
def
get_create_
activity_
by_object_ap_id
(
ap_id
)
when
is_binary
(
ap_id
)
do
def
get_create_by_object_ap_id
(
ap_id
)
when
is_binary
(
ap_id
)
do
create_by_object_ap_id
(
ap_id
)
|>
Repo
.
one
()
end
def
get_create_
activity_
by_object_ap_id
(
_
),
do
:
nil
def
get_create_by_object_ap_id
(
_
),
do
:
nil
def
normalize
(
obj
)
when
is_map
(
obj
),
do
:
Activity
.
get_by_ap_id
(
obj
[
"id"
])
def
normalize
(
ap_id
)
when
is_binary
(
ap_id
),
do
:
Activity
.
get_by_ap_id
(
ap_id
)
def
normalize
(
_
),
do
:
nil
def
get_in_reply_to_activity
(%
Activity
{
data:
%{
"object"
=>
%{
"inReplyTo"
=>
ap_id
}}})
do
get_create_
activity_
by_object_ap_id
(
ap_id
)
get_create_by_object_ap_id
(
ap_id
)
end
def
get_in_reply_to_activity
(
_
),
do
:
nil
...
...
lib/pleroma/web/activity_pub/transmogrifier.ex
View file @
98c8184c
...
...
@@ -141,7 +141,7 @@ def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object)
case
fetch_obj_helper
(
in_reply_to_id
)
do
{
:ok
,
replied_object
}
->
with
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
replied_object
.
data
[
"id"
])
do
Activity
.
get_create_by_object_ap_id
(
replied_object
.
data
[
"id"
])
do
object
|>
Map
.
put
(
"inReplyTo"
,
replied_object
.
data
[
"id"
])
|>
Map
.
put
(
"inReplyToAtomUri"
,
object
[
"inReplyToAtomUri"
]
||
in_reply_to_id
)
...
...
@@ -334,7 +334,7 @@ def handle_incoming(%{"type" => "Create", "object" => %{"type" => objtype} = obj
Map
.
put
(
data
,
"actor"
,
actor
)
|>
fix_addressing
with
nil
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
object
[
"id"
]),
with
nil
<-
Activity
.
get_create_by_object_ap_id
(
object
[
"id"
]),
%
User
{}
=
user
<-
User
.
get_or_fetch_by_ap_id
(
data
[
"actor"
])
do
object
=
fix_object
(
data
[
"object"
])
...
...
lib/pleroma/web/common_api/utils.ex
View file @
98c8184c
...
...
@@ -14,13 +14,13 @@ defmodule Pleroma.Web.CommonAPI.Utils do
# This is a hack for twidere.
def
get_by_id_or_ap_id
(
id
)
do
activity
=
Repo
.
get
(
Activity
,
id
)
||
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
activity
=
Repo
.
get
(
Activity
,
id
)
||
Activity
.
get_create_by_object_ap_id
(
id
)
activity
&&
if
activity
.
data
[
"type"
]
==
"Create"
do
activity
else
Activity
.
get_create_
activity_
by_object_ap_id
(
activity
.
data
[
"object"
])
Activity
.
get_create_by_object_ap_id
(
activity
.
data
[
"object"
])
end
end
...
...
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
98c8184c
...
...
@@ -377,7 +377,7 @@ def reblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
def
unreblog_status
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"id"
=>
ap_id_or_id
})
do
with
{
:ok
,
_unannounce
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
unrepeat
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
activity
,
for:
user
,
as:
:activity
})
...
...
@@ -386,7 +386,7 @@ def unreblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
def
fav_status
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"id"
=>
ap_id_or_id
})
do
with
{
:ok
,
_fav
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
favorite
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
activity
,
for:
user
,
as:
:activity
})
...
...
@@ -395,7 +395,7 @@ def fav_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
def
unfav_status
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"id"
=>
ap_id_or_id
})
do
with
{
:ok
,
_
,
_
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
unfavorite
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
activity
,
for:
user
,
as:
:activity
})
...
...
@@ -743,8 +743,7 @@ def status_search(user, query) do
fetched
=
if
Regex
.
match?
(
~r/https?:/
,
query
)
do
with
{
:ok
,
object
}
<-
ActivityPub
.
fetch_object_from_id
(
query
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_activity_by_object_ap_id
(
object
.
data
[
"id"
]),
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
object
.
data
[
"id"
]),
true
<-
ActivityPub
.
visible_for_user?
(
activity
,
user
)
do
[
activity
]
else
...
...
@@ -1138,7 +1137,7 @@ def empty_object(conn, _) do
def
render_notification
(
user
,
%{
id:
id
,
activity:
activity
,
inserted_at:
created_at
}
=
_params
)
do
actor
=
User
.
get_cached_by_ap_id
(
activity
.
data
[
"actor"
])
parent_activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
activity
.
data
[
"object"
])
parent_activity
=
Activity
.
get_create_by_object_ap_id
(
activity
.
data
[
"object"
])
mastodon_type
=
Activity
.
mastodon_notification_type
(
activity
)
response
=
%{
...
...
lib/pleroma/web/mastodon_api/views/status_view.ex
View file @
98c8184c
...
...
@@ -64,7 +64,7 @@ def render(
user
=
get_user
(
activity
.
data
[
"actor"
])
created_at
=
Utils
.
to_masto_date
(
activity
.
data
[
"published"
])
reblogged
=
Activity
.
get_create_
activity_
by_object_ap_id
(
object
)
reblogged
=
Activity
.
get_create_by_object_ap_id
(
object
)
reblogged
=
render
(
"status.json"
,
Map
.
put
(
opts
,
:activity
,
reblogged
))
mentions
=
...
...
@@ -209,7 +209,7 @@ def get_reply_to(activity, %{replied_to_activities: replied_to_activities}) do
def
get_reply_to
(%{
data:
%{
"object"
=>
object
}},
_
)
do
if
object
[
"inReplyTo"
]
&&
object
[
"inReplyTo"
]
!=
""
do
Activity
.
get_create_
activity_
by_object_ap_id
(
object
[
"inReplyTo"
])
Activity
.
get_create_by_object_ap_id
(
object
[
"inReplyTo"
])
else
nil
end
...
...
lib/pleroma/web/ostatus/activity_representer.ex
View file @
98c8184c
...
...
@@ -183,7 +183,7 @@ def to_simple_form(%{data: %{"type" => "Announce"}} = activity, user, with_autho
_in_reply_to
=
get_in_reply_to
(
activity
.
data
)
author
=
if
with_author
,
do
:
[{
:author
,
UserRepresenter
.
to_simple_form
(
user
)}],
else
:
[]
retweeted_activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
activity
.
data
[
"object"
])
retweeted_activity
=
Activity
.
get_create_by_object_ap_id
(
activity
.
data
[
"object"
])
retweeted_user
=
User
.
get_cached_by_ap_id
(
retweeted_activity
.
data
[
"actor"
])
retweeted_xml
=
to_simple_form
(
retweeted_activity
,
retweeted_user
,
true
)
...
...
lib/pleroma/web/ostatus/handlers/note_handler.ex
View file @
98c8184c
...
...
@@ -86,7 +86,7 @@ def add_external_url(note, entry) do
end
def
fetch_replied_to_activity
(
entry
,
inReplyTo
)
do
with
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
inReplyTo
)
do
with
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
inReplyTo
)
do
activity
else
_e
->
...
...
@@ -103,7 +103,7 @@ def fetch_replied_to_activity(entry, inReplyTo) do
# TODO: Clean this up a bit.
def
handle_note
(
entry
,
doc
\\
nil
)
do
with
id
<-
XML
.
string_from_xpath
(
"//id"
,
entry
),
activity
when
is_nil
(
activity
)
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
),
activity
when
is_nil
(
activity
)
<-
Activity
.
get_create_by_object_ap_id
(
id
),
[
author
]
<-
:xmerl_xpath
.
string
(
'//author[1]'
,
doc
),
{
:ok
,
actor
}
<-
OStatus
.
find_make_or_update_user
(
author
),
content_html
<-
OStatus
.
get_content
(
entry
),
...
...
lib/pleroma/web/ostatus/ostatus.ex
View file @
98c8184c
...
...
@@ -148,7 +148,7 @@ 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
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
{
:ok
,
activity
}
else
_
->
...
...
lib/pleroma/web/ostatus/ostatus_controller.ex
View file @
98c8184c
...
...
@@ -90,8 +90,7 @@ def object(conn, %{"uuid" => uuid}) do
ActivityPubController
.
call
(
conn
,
:object
)
else
with
id
<-
o_status_url
(
conn
,
:object
,
uuid
),
{
_
,
%
Activity
{}
=
activity
}
<-
{
:activity
,
Activity
.
get_create_activity_by_object_ap_id
(
id
)},
{
_
,
%
Activity
{}
=
activity
}
<-
{
:activity
,
Activity
.
get_create_by_object_ap_id
(
id
)},
{
_
,
true
}
<-
{
:public?
,
ActivityPub
.
is_public?
(
activity
)},
%
User
{}
=
user
<-
User
.
get_cached_by_ap_id
(
activity
.
data
[
"actor"
])
do
case
get_format
(
conn
)
do
...
...
lib/pleroma/web/twitter_api/twitter_api.ex
View file @
98c8184c
...
...
@@ -70,14 +70,14 @@ def unblock(%User{} = blocker, params) do
def
repeat
(%
User
{}
=
user
,
ap_id_or_id
)
do
with
{
:ok
,
_announce
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
repeat
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
{
:ok
,
activity
}
end
end
def
unrepeat
(%
User
{}
=
user
,
ap_id_or_id
)
do
with
{
:ok
,
_unannounce
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
unrepeat
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
{
:ok
,
activity
}
end
end
...
...
@@ -92,14 +92,14 @@ def unpin(%User{} = user, ap_id_or_id) do
def
fav
(%
User
{}
=
user
,
ap_id_or_id
)
do
with
{
:ok
,
_fav
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
favorite
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
{
:ok
,
activity
}
end
end
def
unfav
(%
User
{}
=
user
,
ap_id_or_id
)
do
with
{
:ok
,
_unfav
,
_fav
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
unfavorite
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
do
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id
(
id
)
do
{
:ok
,
activity
}
end
end
...
...
lib/pleroma/web/twitter_api/twitter_api_controller.ex
View file @
98c8184c
...
...
@@ -330,12 +330,12 @@ def upload_json(%{assigns: %{user: user}} = conn, %{"media" => media}) do
end
def
get_by_id_or_ap_id
(
id
)
do
activity
=
Repo
.
get
(
Activity
,
id
)
||
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
activity
=
Repo
.
get
(
Activity
,
id
)
||
Activity
.
get_create_by_object_ap_id
(
id
)
if
activity
.
data
[
"type"
]
==
"Create"
do
activity
else
Activity
.
get_create_
activity_
by_object_ap_id
(
activity
.
data
[
"object"
])
Activity
.
get_create_by_object_ap_id
(
activity
.
data
[
"object"
])
end
end
...
...
lib/pleroma/web/twitter_api/views/activity_view.ex
View file @
98c8184c
...
...
@@ -168,7 +168,7 @@ def render("activity.json", %{activity: %{data: %{"type" => "Follow"}} = activit
def
render
(
"activity.json"
,
%{
activity:
%{
data:
%{
"type"
=>
"Announce"
}}
=
activity
}
=
opts
)
do
user
=
get_user
(
activity
.
data
[
"actor"
],
opts
)
created_at
=
activity
.
data
[
"published"
]
|>
Utils
.
date_to_asctime
()
announced_activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
activity
.
data
[
"object"
])
announced_activity
=
Activity
.
get_create_by_object_ap_id
(
activity
.
data
[
"object"
])
text
=
"
#{
user
.
nickname
}
retweeted a status."
...
...
@@ -192,7 +192,7 @@ def render("activity.json", %{activity: %{data: %{"type" => "Announce"}} = activ
def
render
(
"activity.json"
,
%{
activity:
%{
data:
%{
"type"
=>
"Like"
}}
=
activity
}
=
opts
)
do
user
=
get_user
(
activity
.
data
[
"actor"
],
opts
)
liked_activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
activity
.
data
[
"object"
])
liked_activity
=
Activity
.
get_create_by_object_ap_id
(
activity
.
data
[
"object"
])
liked_activity_id
=
if
liked_activity
,
do
:
liked_activity
.
id
,
else
:
nil
created_at
=
...
...
test/activity_test.exs
View file @
98c8184c
...
...
@@ -24,7 +24,7 @@ test "returns activities by it's objects AP ids" do
test
"returns the activity that created an object"
do
activity
=
insert
(
:note_activity
)
found_activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
activity
.
data
[
"object"
][
"id"
])
found_activity
=
Activity
.
get_create_by_object_ap_id
(
activity
.
data
[
"object"
][
"id"
])
assert
activity
==
found_activity
end
...
...
test/web/activity_pub/activity_pub_test.exs
View file @
98c8184c
...
...
@@ -216,7 +216,7 @@ test "doesn't return blocked activities" do
{
:ok
,
user
}
=
User
.
block
(
user
,
%{
ap_id:
activity_three
.
data
[
"actor"
]})
{
:ok
,
_announce
,
%{
data:
%{
"id"
=>
id
}}}
=
CommonAPI
.
repeat
(
activity_three
.
id
,
booster
)
%
Activity
{}
=
boost_activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
id
)
%
Activity
{}
=
boost_activity
=
Activity
.
get_create_by_object_ap_id
(
id
)
activity_three
=
Repo
.
get
(
Activity
,
activity_three
.
id
)
activities
=
ActivityPub
.
fetch_activities
([],
%{
"blocking_user"
=>
user
})
...
...
@@ -445,7 +445,7 @@ test "it fetches an object" do
{
:ok
,
object
}
=
ActivityPub
.
fetch_object_from_id
(
"http://mastodon.example.org/@admin/99541947525187367"
)
assert
activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
object
.
data
[
"id"
])
assert
activity
=
Activity
.
get_create_by_object_ap_id
(
object
.
data
[
"id"
])
assert
activity
.
data
[
"id"
]
{
:ok
,
object_again
}
=
...
...
@@ -459,7 +459,7 @@ test "it fetches an object" do
test
"it works with objects only available via Ostatus"
do
{
:ok
,
object
}
=
ActivityPub
.
fetch_object_from_id
(
"https://shitposter.club/notice/2827873"
)
assert
activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
object
.
data
[
"id"
])
assert
activity
=
Activity
.
get_create_by_object_ap_id
(
object
.
data
[
"id"
])
assert
activity
.
data
[
"id"
]
{
:ok
,
object_again
}
=
...
...
test/web/activity_pub/transmogrifier_test.exs
View file @
98c8184c
...
...
@@ -51,7 +51,7 @@ test "it fetches replied-to activities if we don't have them" do
{
:ok
,
returned_activity
}
=
Transmogrifier
.
handle_incoming
(
data
)
assert
activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
Activity
.
get_create_by_object_ap_id
(
"tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
)
...
...
@@ -263,7 +263,7 @@ test "it works for incoming announces" do
assert
data
[
"object"
]
==
"http://mastodon.example.org/users/admin/statuses/99541947525187367"
assert
Activity
.
get_create_
activity_
by_object_ap_id
(
data
[
"object"
])
assert
Activity
.
get_create_by_object_ap_id
(
data
[
"object"
])
end
test
"it works for incoming announces with an existing activity"
do
...
...
@@ -285,7 +285,7 @@ test "it works for incoming announces with an existing activity" do
assert
data
[
"object"
]
==
activity
.
data
[
"object"
][
"id"
]
assert
Activity
.
get_create_
activity_
by_object_ap_id
(
data
[
"object"
])
.
id
==
activity
.
id
assert
Activity
.
get_create_by_object_ap_id
(
data
[
"object"
])
.
id
==
activity
.
id
end
test
"it does not clobber the addressing on announce activities"
do
...
...
test/web/mastodon_api/status_view_test.exs
View file @
98c8184c
...
...
@@ -202,7 +202,7 @@ test "a peertube video" do
"https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
)
%
Activity
{}
=
activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
object
.
data
[
"id"
])
%
Activity
{}
=
activity
=
Activity
.
get_create_by_object_ap_id
(
object
.
data
[
"id"
])
represented
=
StatusView
.
render
(
"status.json"
,
%{
for:
user
,
activity:
activity
})
...
...
test/web/twitter_api/twitter_api_test.exs
View file @
98c8184c
...
...
@@ -451,7 +451,7 @@ test "fetches a user by uri" do
assert
represented
[
"id"
]
==
UserView
.
render
(
"show.json"
,
%{
user:
remote
,
for:
user
})[
"id"
]
# Also fetches the feed.
# assert Activity.get_create_
activity_
by_object_ap_id("tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status")
# assert Activity.get_create_by_object_ap_id("tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status")
end
end
end
test/web/twitter_api/views/activity_view_test.exs
View file @
98c8184c
...
...
@@ -344,7 +344,7 @@ test "a peertube video" do
"https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
)
%
Activity
{}
=
activity
=
Activity
.
get_create_
activity_
by_object_ap_id
(
object
.
data
[
"id"
])
%
Activity
{}
=
activity
=
Activity
.
get_create_by_object_ap_id
(
object
.
data
[
"id"
])
result
=
ActivityView
.
render
(
"activity.json"
,
activity:
activity
)
...
...
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