Twarrt
final class Twarrt : Model, Searchable
extension Twarrt: ContentFilterable
extension Twarrt: Reportable
An individual post in the Twitarr stream. Posts must contain text content, and may also contain images.
Twarrts are content that can be quarantined or locked by moderators. A quarantined twarrt will have its contents replaced with a quarantine message, and will not have any images. A locked twarrt can only be modified by moderators. When edited, twarrts create edit records showing previous state for moderation purposes.
V2 of Twitarr (and, actual Twitter) have tweet replies that work as a directed acyclic graph. Any tweet can be created as a reply to an existing tweet,
a tweet can have multiple direct reply tweets, and a tweet can be both a reply to another tweet and the target of other replies. V3 doesn’t work that way.
A new twarrt replying to a twarrt not already in a Reply Group creates a Reply Group, and both the replied–to and reply twarrt have their replyGroup
set to the ID of the replied-to twarrt. A reply to a twarrt already in a Reply Group gets added to the Reply Group.
This means that any twarrt that has a non-null replyGroup has a thread can can be retrieved. It also means that replies are one level deep–a reply to a reply is not considered differernt than a 2 replies to a single twarrt.
See
See Also: TwarrtData the DTO for returning basic data on Twarrts.See
See Also: TwarrtDetailData the DTO for returning basic data on Twarrts.See
See Also: PostData the DTO for creating or editing Twarrts.See
See Also: CreateTwarrtSchema the Migration for creating the Twarrts table in the database.-
Declaration
Swift
static let schema: String
-
The twarrt’s ID.
Declaration
Swift
@ID var id: Int?
-
The text content of the twarrt.
Declaration
Swift
@Field var text: String
-
The filenames of any images for the post.
Declaration
Swift
@OptionalField var images: [String]?
-
Moderators can set several statuses on twarrts that modify editability and visibility.
Declaration
Swift
@Enum var moderationStatus: ContentModerationStatus
-
Timestamp of the model’s creation, set automatically.
Declaration
Swift
@Timestamp var createdAt: Date?
-
Timestamp of the model’s last update, set automatically.
Declaration
Swift
@Timestamp var updatedAt: Date?
-
Timestamp of the model’s soft-deletion, set automatically.
Declaration
Swift
@Timestamp var deletedAt: Date?
-
The twarrt’s author.
Declaration
Swift
@Parent var author: User
-
When a twarrt is created as a reply to another twarrt, both twarrts get their
replyGroup
set to the ID of the replied-to twarrt. When a reply is created and the replied-to twarrt is already in a reply group, the new reply joins the existing reply group.Declaration
Swift
@OptionalParent var replyGroup: Twarrt?
-
The child
TwarrtEdit
accountability records of the twarrt.Declaration
Swift
@Children var edits: [TwarrtEdit]
-
Declaration
Swift
init()
-
Initializes a new Twarrt.
Declaration
Swift
init(authorID: UUID, text: String, images: [String]? = nil, replyTo: Twarrt? = nil) throws
Parameters
author
The author of the twarrt.
text
The text content of the twarrt.
image
The filename of any image content of the twarrt.
replyTo
The twarrt being replied to, if any.
-
Declaration
Swift
func contentTextStrings() -> [String]
-
The type for
Twarrt
reports.Declaration
Swift
var reportType: ReportType { get }
-
Declaration
Swift
var authorUUID: UUID { get }
-
Declaration
Swift
var autoQuarantineThreshold: Int { get }