ModerationController
struct ModerationController : APIRouteCollectionThe collection of /api/v3/mod/ route endpoints and handler functions related to moderation tasks.
All routes in this group should be restricted to users with moderation priviliges. This controller returns data of a privileged nature, including contents of user reports, edit histories of user content, and log data about moderation actions.
Note that some moderation actions aren’t in this file. Most such endpoints have a handler method allowing a user
to operate on their own content, but also allowing a mod to operate on other users’ content. For example, twarrtUpdateHandler lets
a user edit a twarrt they wrote, but also lets mods edit any user’s twarrt.
The routes in this controller that return data on various Reportable content types are designed to return everything a Mod might need to make moderation decisions, all in one call. In many cases that means calls return multiple array types with no paging or array limits. In non-degenerate cases the arrays should less than ~20 elements. Additionally, there are few moderators and they won’t be calling these methods multiple times per second.
- 
                  
                  Required. Registers routes to the incoming router. DeclarationSwift func registerRoutes(_ app: Application) throws
- 
                  reportsHandler(_:Asynchronous) GET /api/v3/mod/reportsRetrieves the full Reportmodel of all reports.Throws 403 error if the user is not an admin.DeclarationSwift func reportsHandler(_ req: Request) async throws -> [ReportModerationData]Return ValueAn array of Reportobjects
- 
                  beginProcessingReportsHandler(_:Asynchronous) POST /api/v3/mod/reports/ID/handleallThis call is how a Moderator can take a user Report off the queue and begin handling it. More correctly, it takes all user reports referring to the same piece of content and marks them all handled at once. Moving reports through the ‘handling’ state is not necessary–you can go straight to ‘closed’–but this marks the reports as being ‘taken’ by the given mod so other mods can avoid duplicate or conflicting work. Also, any ModeratorActions taken while a mod has reports in the ‘handling’ state get tagged with an identifier that matches the actions to the reports. Reports should be closed once a mod is done with them. Throws 403 error if the user is not an admin.DeclarationSwift func beginProcessingReportsHandler(_ req: Request) async throws -> HTTPStatusParametersreportIDin URL path. Note that this method actually operates on all reports referring to the same content as the indicated report. Return Value200 OK on success 
- 
                  closeReportsHandler(_:Asynchronous) POST /api/v3/mod/reports/ID/closeallCloses all reports filed against the same piece of content as the given report. That is, if there are several user reports concerning the same post, this will close all of them. Throws 403 error if the user is not an admin.DeclarationSwift func closeReportsHandler(_ req: Request) async throws -> HTTPStatusParametersreportIDin URL path. Note that this method actually operates on all reports referring to the same content as the indicated report. Return Value200 OK on success 
- 
                  moderatorActionLogHandler(_:Asynchronous) GET /api/v3/mod/moderationlogRetrieves ModeratorAction records. These records are a log of Mods using their Mod powers. Generally, if an action 1) modifies the database and 2) requires that the acting user be a mod to perform the action, it will get logged. Note A mod editing/deleting their own content will not get logged, even if they use a Moderator-only API call to do it.URL Query Parameters: - ?start=INT- the offset from the anchor to start. Offset only counts twarrts that pass the filters.
- ?limit=INT- the maximum number of twarrts to retrieve: 1-200, default is 50
 Throws 403 error if the user is not an admin. DeclarationSwift func moderatorActionLogHandler(_ req: Request) async throws -> ModeratorActionLogResponseDataReturn ValueAn array of ModeratorActionLogDatarecords.
- 
                  twarrtModerationHandler(_:Asynchronous) GET /api/v3/mod/twarrt/IDModerator only. Returns info admins and moderators need to review a twarrt. Works if twarrt has been deleted. Shows twarrt’s quarantine and reviewed states. The TwarrtModerationDatacontains:- The current twarrt contents, even if its deleted
- Previous edits of the twarrt
- Reports against the twarrt
- The twarrt’s current deletion and moderation status. 
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func twarrtModerationHandler(_ req: Request) async throws -> TwarrtModerationDataParameterstwarrtIDin URL path. Return ValueTwarrtModerationDatacontaining a bunch of data pertinient to moderating the twarrt.
- 
                  twarrtSetModerationStateHandler(_:Asynchronous) POST /api/v3/mod/twarrt/ID/setstate/STRINGModerator only. Sets the moderation state enum on the twarrt identified by ID to the ContentModerationStatusin STRING. Logs the action to the moderator log unless the user owns the twarrt.Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func twarrtSetModerationStateHandler(_ req: Request) async throws -> HTTPStatusParameterstwarrtIDin URL path. moderationStatein URL path. Value must match a ContentModerationStatusrawValue.Return ValueHTTPStatus.ok if the requested moderation status was set.
- 
                  forumPostModerationHandler(_:Asynchronous) GET /api/v3/mod/forumpost/IDModerator only. Returns info admins and moderators need to review a forumPost. Works if forumPost has been deleted. Shows forumPost’s quarantine and reviewed states. The ForumPostModerationDatacontains:- The current post contents, even if its deleted
- Previous edits of the post
- Reports against the post
- The post’s current deletion and moderation status. 
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func forumPostModerationHandler(_ req: Request) async throws -> ForumPostModerationDataParameterspostIDin URL path. Return ValueForumPostModerationDatacontaining a bunch of data pertinient to moderating the post.
- 
                  forumPostSetModerationStateHandler(_:Asynchronous) POST /api/v3/mod/forumpost/ID/setstate/STRINGModerator only. Sets the moderation state enum on the post idententified by ID to the ContentModerationStatusin STRING. Logs the action to the moderator log unless the user owns the post.Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func forumPostSetModerationStateHandler(_ req: Request) async throws -> HTTPStatusParameterspostIDin URL path. moderationStatein URL path. Value must match a ContentModerationStatusrawValue.Return ValueHTTPStatus.ok if the requested moderation status was set.
- 
                  forumModerationHandler(_:Asynchronous) GET /api/v3/mod/forum/IDModerator only. Returns info admins and moderators need to review a forum. Works if forum has been deleted. Shows forum’s quarantine and reviewed states. Reports against forums should be reserved for reporting problems with the forum’s title. Likely, they’ll also get used to report problems with individual posts. The ForumModerationDatacontains:- The current forum contents, even if its deleted
- Previous edits of the forum
- Reports against the forum
- The forum’s current deletion and moderation status. 
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func forumModerationHandler(_ req: Request) async throws -> ForumModerationDataParametersforumIDin URL path. Return ValueForumModerationDatacontaining a bunch of data pertinient to moderating the forum.
- 
                  forumSetModerationStateHandler(_:Asynchronous) POST /api/v3/mod/forum/ID/setstate/STRINGModerator only. Sets the moderation state enum on the forum idententified by ID to the ContentModerationStatusin STRING. Logs the action to the moderator log unless the current user owns the forum.Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func forumSetModerationStateHandler(_ req: Request) async throws -> HTTPStatusParametersforumIDin URL path. moderationStatein URL path. Value must match a ContentModerationStatusrawValue.Return ValueHTTPStatus.ok if the requested moderation status was set.
- 
                  forumSetCategoryHandler(_:Asynchronous) `POST /api/v3/mod/forum/:forum_ID/setcategory/:category_ID Moderator only. Moves the indicated forum into the indicated category. Logs the action to the moderation log. DeclarationSwift func forumSetCategoryHandler(_ req: Request) async throws -> HTTPStatus
- 
                  fezModerationHandler(_:Asynchronous) GET /api/v3/mod/fez/IDModerator only. Returns info admins and moderators need to review a Fez. Works if fez has been deleted. Shows fez’s quarantine and reviewed states. The FezModerationDatacontains:- The current fez contents, even if its deleted
- Previous edits of the fez
- Reports against the fez
- The fez’s current deletion and moderation status. 
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func fezModerationHandler(_ req: Request) async throws -> FezModerationDataParametersfezIDin URL path. Return ValueFezModerationDatacontaining a bunch of data pertinient to moderating the forum.
- 
                  fezSetModerationStateHandler(_:Asynchronous) POST /api/v3/mod/fez/ID/setstate/STRINGModerator only. Sets the moderation state enum on the fez identified by ID to the ContentModerationStatusin STRING. Logs the action to the moderator log unless the current user owns the fez.Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func fezSetModerationStateHandler(_ req: Request) async throws -> HTTPStatusParametersfezIDin URL path. moderationStatein URL path. Value must match a ContentModerationStatusrawValue.Return ValueHTTPStatus.ok if the requested moderation status was set.
- 
                  fezPostModerationHandler(_:Asynchronous) GET /api/v3/mod/fezpost/:post_idModerator only. Returns info admins and moderators need to review a Fez post. Works if post has been deleted. Shows fez’s quarantine and reviewed states. Unlike most other content types, Fez Posts cannot be edited (although they may be deleted). The FezPostModerationDatacontains:- The current post contents, even if its deleted
- Reports against the post
- The post’s current deletion and moderation status. 
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func fezPostModerationHandler(_ req: Request) async throws -> FezPostModerationDataParametersfezPostIDin URL path. Return ValueFezPostModerationDatacontaining a bunch of data pertinient to moderating the forum.
- 
                  fezPostSetModerationStateHandler(_:Asynchronous) POST /api/v3/mod/fezpost/:post_id/setstate/STRINGModerator only. Sets the moderation state enum on the fez post identified by ID to the ContentModerationStatusin STRING. Logs the action to the moderator log unless the current user authored the post.Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func fezPostSetModerationStateHandler(_ req: Request) async throws -> HTTPStatusParametersfezPostIDin URL path. moderationStatein URL path. Value must match a ContentModerationStatusrawValue.Return ValueHTTPStatus.ok if the requested moderation status was set.
- 
                  profileModerationHandler(_:Asynchronous) GET /api/v3/mod/profile/IDModerator only. Returns info admins and moderators need to review a User Profile. The returned info pertains to the user’s profile and avatar image – for example, the web site puts the button allowing mods to edit a user’s profile fields on this page. The ProfileModerationDatacontains:- The user’s profile info and avatar
- Previous edits of the profile and avatar
- Reports against the user’s profile
- The user’s current moderation status. 
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func profileModerationHandler(_ req: Request) async throws -> ProfileModerationDataParametersuserIDin URL path. Return ValueProfileModerationDatacontaining a bunch of data pertinient to moderating the user’s profile.
- 
                  profileSetModerationStateHandler(_:Asynchronous) POST /api/v3/mod/profile/ID/setstate/STRINGModerator only. Sets the moderation state enum on the profile idententified by userID to the ContentModerationStatusin STRING. Logs the action to the moderator log unless the moderator is changing state on their own profile..Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func profileSetModerationStateHandler(_ req: Request) async throws -> HTTPStatusParametersuserIDin URL path. moderationStatein URL path. Value must match a ContentModerationStatusrawValue.Return ValueHTTPStatus.ok if the requested moderation status was set.
- 
                  userModerationHandler(_:Asynchronous) GET /api/v3/mod/user/IDModerator only. Returns info admins and moderators need to review a User. User moderation in this context means actions taken against the User account itself, such as banning and temp-quarantining. These actions don’t edit or remove content but prevent the user from creating any more content. The UserModerationDatacontains:- UserHeaders for the User’s primary account and any sub-accounts.
- Reports against content authored by any of the above accounts, for all content types (twarrt, forum posts, profile, user image)
- The user’s current access level.
- Any temp ban the user has. 
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func userModerationHandler(_ req: Request) async throws -> UserModerationDataParametersuserIDin URL path. Return ValueUserModerationDatacontaining a bunch of data pertinient to moderating the forum.
- 
                  userSetAccessLevelHandler(_:Asynchronous) POST /api/v3/mod/user/ID/setaccesslevel/STRINGModerator only. Sets the accessLevel enum on the user idententified by userID to the UserAccessLevelin STRING. Moderators (and above) cannot use this method to change the access level of other mods (and above). Nor can they use this to reduce their own access level to non-moderator status.This method cannot be used to elevate access level to moderatoror higher. APIs to do this are in AdminController.The primary account and all sub-accounts linked to the given User account are affected by the change in access level. The passed-in UserID may be either a primary or sub-account. Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func userSetAccessLevelHandler(_ req: Request) async throws -> HTTPStatusParametersuserIDin URL path. accessLevelin URL path. Value must match a UserAccessLevelrawValue.Return ValueHTTPStatus.ok if the requested access level was set.
- 
                  applyUserTempQuarantine(_:Asynchronous) POST /api/v3/mod/user/ID/tempquarantine/INTModerator only. Applies a tempory quarantine on a user for INT hours, starting immediately. While quarantined, the user may not create or edit content, but can still read others’ content. They can still talk in private Seamail chats. The primary account and all sub-accounts linked to the given User account are affected by the temporary ban. The passed-in UserID may be either a primary or sub-account. Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func applyUserTempQuarantine(_ req: Request) async throws -> HTTPStatusParametersuserIDin URL path. quarantineHoursin URL path. Must be a integer number. Return ValueHTTPStatus.ok if the requested quarantine was set.
- 
                  getFullSongList(_:Asynchronous) GET /api/v3/mod/microkaraoke/songlistGets info on all the songs that are in Micro Karaoke, including ones being built. Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func getFullSongList(_ req: Request) async throws -> [MicroKaraokeCompletedSong]Return Value[MicroKaraokeCompletedSong]with info on all the completed songs that can be viewed.
- 
                  getSongInfo(_:Asynchronous) GET /api/v3/mod/microkaraoke/song/:song_idGets info on a single song in Micro Karaoke.. Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func getSongInfo(_ req: Request) async throws -> MicroKaraokeCompletedSongReturn ValueMicroKaraokeCompletedSongwith info on the song with the given songID.
- 
                  getSnippetsForModeration(_:Asynchronous) GET /api/v3/mod/microkaraoke/snippets/:song_idThrows A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func getSnippetsForModeration(_ req: Request) async throws -> [MicroKaraokeSnippetModeration]Parameterssong_idThe song to get a manifest for. Return Value
- 
                  deleteSnippet(_:Asynchronous) POST /api/v3/mod/microkaraoke/snippet/:snippet_id/deleteDELETE /api/v3/mod/microkaraoke/snippet/:snippet_id/Moderator only. By design, users may not delete their own submissions. Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func deleteSnippet(_ req: Request) async throws -> HTTPStatusParameterssnippet_idThe snippet ID to delete. NOT the snippet index–the index just tells you where the snippet gets inserted into its song. Return Value
- 
                  approveSong(_:Asynchronous) POST /api/v3/mod/microkaraoke/approve/:song_idApprove a song for release. Once approved, notifications are sent out to each user that sung a clip in the song. For this reason, there is not currently an ‘unapprove’ action, as re-approving would currently re-send all the notifications. If an approved song contains an objectionable clip, use the mod tools to delete the clip. Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func approveSong(_ req: Request) async throws -> HTTPStatusParameterssong_idThe song ID to approve. Return ValueHTTP Status` 
 View on GitHub
            View on GitHub
           ModerationController Structure Reference
      ModerationController Structure Reference