Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F41668367
participation_recipient_ship.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
975 B
Referenced Files
None
Subscribers
None
participation_recipient_ship.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Conversation.Participation.RecipientShip
do
use
Ecto.Schema
alias
Pleroma.Conversation.Participation
alias
Pleroma.Repo
alias
Pleroma.User
import
Ecto.Changeset
schema
"conversation_participation_recipient_ships"
do
belongs_to
(
:user
,
User
,
type
:
FlakeId.Ecto.CompatType
)
belongs_to
(
:participation
,
Participation
)
end
def
creation_cng
(
struct
,
params
)
do
struct
|>
cast
(
params
,
[
:user_id
,
:participation_id
])
|>
validate_required
([
:user_id
,
:participation_id
])
end
def
create
(%
User
{}
=
user
,
participation
),
do
:
create
([
user
],
participation
)
def
create
(
users
,
participation
)
do
Enum
.
each
(
users
,
fn
user
->
%
__MODULE__
{}
|>
creation_cng
(%{
user_id
:
user
.
id
,
participation_id
:
participation
.
id
})
|>
Repo
.
insert!
()
end
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sun, Feb 15, 5:51 AM (2 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
988247
Default Alt Text
participation_recipient_ship.ex (975 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment