Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F162738
scheduled_activity_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
scheduled_activity_view.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.MastodonAPI.ScheduledActivityView
do
use
Pleroma.Web
,
:view
alias
Pleroma.ScheduledActivity
alias
Pleroma.Web.CommonAPI
alias
Pleroma.Web.MastodonAPI.StatusView
def
render
(
"index.json"
,
%{
scheduled_activities
:
scheduled_activities
})
do
render_many
(
scheduled_activities
,
__MODULE__
,
"show.json"
)
end
def
render
(
"show.json"
,
%{
scheduled_activity
:
%
ScheduledActivity
{}
=
scheduled_activity
})
do
%{
id
:
to_string
(
scheduled_activity
.
id
),
scheduled_at
:
CommonAPI.Utils
.
to_masto_date
(
scheduled_activity
.
scheduled_at
),
params
:
status_params
(
scheduled_activity
.
params
)
}
|>
with_media_attachments
(
scheduled_activity
)
end
defp
with_media_attachments
(
data
,
%{
params
:
%{
"media_attachments"
=>
media_attachments
}})
do
attachments
=
render_many
(
media_attachments
,
StatusView
,
"attachment.json"
,
as
:
:attachment
)
Map
.
put
(
data
,
:media_attachments
,
attachments
)
end
defp
with_media_attachments
(
data
,
_
),
do
:
data
defp
status_params
(
params
)
do
%{
text
:
params
[
"status"
],
sensitive
:
params
[
"sensitive"
],
spoiler_text
:
params
[
"spoiler_text"
],
visibility
:
params
[
"visibility"
],
scheduled_at
:
params
[
"scheduled_at"
],
poll
:
params
[
"poll"
],
in_reply_to_id
:
params
[
"in_reply_to_id"
],
expires_in
:
params
[
"expires_in"
]
}
|>
Pleroma.Maps
.
put_if_present
(
:media_ids
,
params
[
"media_ids"
])
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Fri, Feb 21, 5:46 PM (13 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
66815
Default Alt Text
scheduled_activity_view.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment