Report
final class Report : Model, @unchecked Sendable
Twit-arr moderation relies in part on user-submitted reports of content and/or behavior
which does not conform to community standards. A Report can be submitted for Moderator
review on any of: an individual Twarrt or ForumPost, an entire Forum, a FezPost,
or a User (such as for general behavioral pattern, or their profile contents).
The .submitterID is always the user’s primary user ID. An individual post can only be
reported once per primary user. There is no per user restriction on the number of reports
of a particular Forum or User.
The .reportedID field is a string value, because the entity being reported may have
either a UUID or an integer based ID, which is determined via the .reportType.
The lifecycle flow of Reports is:
- Created by submitter
- Viewed by a moderator in a list of open reports
- Moderator takes the report (handledBy is set to the moderator’s UUID). Other mods should be able to see the report is being handled.
- Moderator modifies content, quarantines content, warns user, bans user, or takes some other action.
- Moderator fills in actionTaken field and closes the report.
-
Declaration
Swift
static let schema: String
-
The report’s ID.
Declaration
Swift
@Report .ID var id: UUID? { get set } -
The type of entity reported.
Declaration
Swift
@Report .Field var reportType: ReportType { get set } -
The ID of the entity reported. Could resolve to an Int or a UUID, depending on the value of
reportType.Declaration
Swift
@Report .Field var reportedID: String { get set } -
An optional message from the submitter.
Declaration
Swift
@Report .Field var submitterMessage: String { get set } -
Set to a new UUID() when a Moderator starts handling one or more reports. Any mod actions the mod takes until these reports are closed get tagged with this UUID. Reports may be closed without ever setting an action group.
Declaration
Swift
@Report .OptionalField var actionGroup: UUID? { get set } -
The status of the report.
Declaration
Swift
@Report .Field var isClosed: Bool { get set } -
Timestamp of the model’s creation, set automatically.
Declaration
Swift
@Report .Timestamp var createdAt: Date? { get set } -
Timestamp of the model’s last update, set automatically.
Declaration
Swift
@Report .Timestamp var updatedAt: Date? { get set }
-
Declaration
Swift
init() -
Initializes a new Report.
Declaration
Swift
init<T>(reportedContent: T, submitter: User, submitterMessage: String = "") throws where T : ReportableParameters
reportTypeThe type of entity reported.
reportedIDThe ID of the entity reported.
submitterThe user submitting the report.
submitterMessageAn optional message from the submitter.
View on GitHub