Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F84165442
notification_setting.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
821 B
Referenced Files
None
Subscribers
None
notification_setting.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.User.NotificationSetting
do
use
Ecto.Schema
import
Ecto.Changeset
@derive
Jason.Encoder
@primary_key
false
embedded_schema
do
field
(
:block_from_strangers
,
:boolean
,
default
:
false
)
field
(
:hide_notification_contents
,
:boolean
,
default
:
false
)
end
def
changeset
(
schema
,
params
)
do
schema
|>
cast
(
prepare_attrs
(
params
),
[
:block_from_strangers
,
:hide_notification_contents
])
end
defp
prepare_attrs
(
params
)
do
Enum
.
reduce
(
params
,
%{},
fn
{
k
,
v
},
acc
when
is_binary
(
v
)
->
Map
.
put
(
acc
,
k
,
String
.
downcase
(
v
))
{
k
,
v
},
acc
->
Map
.
put
(
acc
,
k
,
v
)
end
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Thu, Jun 4, 6:41 PM (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1505981
Default Alt Text
notification_setting.ex (821 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment