Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F84166356
scrobble_view.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
scrobble_view.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.PleromaAPI.ScrobbleView
do
use
Pleroma.Web
,
:view
require
Pleroma.Constants
alias
Pleroma.Activity
alias
Pleroma.HTML
alias
Pleroma.Object
alias
Pleroma.Web.CommonAPI
alias
Pleroma.Web.CommonAPI.Utils
alias
Pleroma.Web.MastodonAPI.AccountView
def
render
(
"show.json"
,
%{
activity
:
%
Activity
{
data
:
%{
"type"
=>
"Listen"
}}
=
activity
}
=
opts
)
do
object
=
Object
.
normalize
(
activity
)
user
=
CommonAPI
.
get_user
(
activity
.
data
[
"actor"
])
created_at
=
Utils
.
to_masto_date
(
activity
.
data
[
"published"
])
%{
id
:
activity
.
id
,
account
:
AccountView
.
render
(
"show.json"
,
%{
user
:
user
,
for
:
opts
[
:for
]}),
created_at
:
created_at
,
title
:
object
.
data
[
"title"
]
|>
HTML
.
strip_tags
(),
artist
:
object
.
data
[
"artist"
]
|>
HTML
.
strip_tags
(),
album
:
object
.
data
[
"album"
]
|>
HTML
.
strip_tags
(),
length
:
object
.
data
[
"length"
]
}
end
def
render
(
"index.json"
,
opts
)
do
safe_render_many
(
opts
.
activities
,
__MODULE__
,
"show.json"
,
opts
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Thu, Jun 4, 7:02 PM (16 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1320660
Default Alt Text
scrobble_view.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment