Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85197958
emoji_reaction_view.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
949 B
Referenced Files
None
Subscribers
None
emoji_reaction_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.EmojiReactionView
do
use
Pleroma.Web
,
:view
alias
Pleroma.Web.MastodonAPI.AccountView
def
render
(
"index.json"
,
%{
emoji_reactions
:
emoji_reactions
}
=
opts
)
do
render_many
(
emoji_reactions
,
__MODULE__
,
"show.json"
,
opts
)
end
def
render
(
"show.json"
,
%{
emoji_reaction
:
[
emoji
,
user_ap_ids
],
user
:
user
})
do
users
=
fetch_users
(
user_ap_ids
)
%{
name
:
emoji
,
count
:
length
(
users
),
accounts
:
render
(
AccountView
,
"index.json"
,
users
:
users
,
for
:
user
,
as
:
:user
),
me
:
!!
(
user
&&
user
.
ap_id
in
user_ap_ids
)
}
end
defp
fetch_users
(
user_ap_ids
)
do
user_ap_ids
|>
Enum
.
map
(
&
Pleroma.User
.
get_cached_by_ap_id
/
1
)
|>
Enum
.
filter
(
fn
%{
deactivated
:
false
}
->
true
_
->
false
end
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Mon, Jun 29, 9:42 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1547967
Default Alt Text
emoji_reaction_view.ex (949 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment