Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F55939611
activity_representer.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
activity_representer.ex
View Options
defmodule
Pleroma.Web.OStatus.ActivityRepresenter
do
def
to_simple_form
(%{
data
:
%{
"object"
=>
%{
"type"
=>
"Note"
}}}
=
activity
,
user
)
do
h
=
fn
(
str
)
->
[
to_charlist
(
str
)]
end
updated_at
=
activity
.
updated_at
|>
NaiveDateTime
.
to_iso8601
inserted_at
=
activity
.
inserted_at
|>
NaiveDateTime
.
to_iso8601
attachments
=
Enum
.
map
(
activity
.
data
[
"object"
][
"attachment"
]
||
[],
fn
(
attachment
)
->
url
=
hd
(
attachment
[
"url"
])
{
:link
,
[
rel
:
'enclosure'
,
href
:
to_charlist
(
url
[
"href"
]),
type
:
to_charlist
(
url
[
"mediaType"
])],
[]}
end
)
[
{
:"activity:object-type"
,
[
'http://activitystrea.ms/schema/1.0/note'
]},
{
:"activity:verb"
,
[
'http://activitystrea.ms/schema/1.0/post'
]},
{
:id
,
h
.
(
activity
.
data
[
"object"
][
"id"
])},
{
:title
,
[
'New note by
#{
user
.
nickname
}
'
]},
{
:content
,
[
type
:
'html'
],
h
.
(
activity
.
data
[
"object"
][
"content"
])},
{
:published
,
h
.
(
inserted_at
)},
{
:updated
,
h
.
(
updated_at
)}
]
++
attachments
end
def
to_simple_form
(
_
,
_
),
do
:
nil
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Fri, Apr 3, 9:46 AM (22 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1257578
Default Alt Text
activity_representer.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment