Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F84167389
common_fields.ex
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
common_fields.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.ActivityPub.ObjectValidators.CommonFields
do
alias
Pleroma.EctoType.ActivityPub.ObjectValidators
alias
Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator
alias
Pleroma.Web.ActivityPub.ObjectValidators.TagValidator
# Activities and Objects, except (Create)ChatMessage
defmacro
message_fields
do
quote
bind_quoted
:
binding
()
do
field
(
:type
,
:string
)
field
(
:id
,
ObjectValidators.ObjectID
,
primary_key
:
true
)
field
(
:to
,
ObjectValidators.Recipients
,
default
:
[])
field
(
:cc
,
ObjectValidators.Recipients
,
default
:
[])
field
(
:bto
,
ObjectValidators.Recipients
,
default
:
[])
field
(
:bcc
,
ObjectValidators.Recipients
,
default
:
[])
end
end
defmacro
activity_fields
do
quote
bind_quoted
:
binding
()
do
field
(
:object
,
ObjectValidators.ObjectID
)
field
(
:actor
,
ObjectValidators.ObjectID
)
end
end
# All objects except Answer and ChatMessage
defmacro
object_fields
do
quote
bind_quoted
:
binding
()
do
field
(
:content
,
:string
)
field
(
:published
,
ObjectValidators.DateTime
)
field
(
:updated
,
ObjectValidators.DateTime
)
field
(
:emoji
,
ObjectValidators.Emoji
,
default
:
%{})
embeds_many
(
:attachment
,
AttachmentValidator
)
end
end
# Basically objects that aren't ChatMessage and Answer
defmacro
status_object_fields
do
quote
bind_quoted
:
binding
()
do
# TODO: Remove actor on objects
field
(
:actor
,
ObjectValidators.ObjectID
)
field
(
:attributedTo
,
ObjectValidators.ObjectID
)
embeds_many
(
:tag
,
TagValidator
)
field
(
:name
,
:string
)
field
(
:summary
,
:string
)
field
(
:context
,
:string
)
field
(
:sensitive
,
:boolean
,
default
:
false
)
field
(
:replies_count
,
:integer
,
default
:
0
)
field
(
:like_count
,
:integer
,
default
:
0
)
field
(
:announcement_count
,
:integer
,
default
:
0
)
field
(
:quotes_count
,
:integer
,
default
:
0
)
field
(
:inReplyTo
,
ObjectValidators.ObjectID
)
field
(
:quoteUrl
,
ObjectValidators.ObjectID
)
field
(
:url
,
ObjectValidators.BareUri
)
field
(
:likes
,
{
:array
,
ObjectValidators.ObjectID
},
default
:
[])
field
(
:announcements
,
{
:array
,
ObjectValidators.ObjectID
},
default
:
[])
end
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jun 4, 7:28 PM (34 m, 35 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1538387
Default Alt Text
common_fields.ex (2 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment