Enumerations
-
Moderation status of a piece of reportable content. This enum is used both in Models and in data transfer objects in the API. Be very careful about renaming enum cases or customizing case strings.
See moreDeclaration
Swift
enum ContentModerationStatus : String, Codable
-
Declaration
Swift
private enum EventModification
-
Declaration
Swift
public enum EventType : String, Codable
-
Enum definition of built-in exportable image raster formats
- bmp: https://en.wikipedia.org/wiki/BMP_file_format
- gif: https://en.wikipedia.org/wiki/gif
- jpg: https://en.wikipedia.org/wiki/jpeg
- png: https://en.wikipedia.org/wiki/Portable_Network_Graphics
- tiff: https://en.wikipedia.org/wiki/tiff
- wbmp: https://en.wikipedia.org/wiki/wbmp
- webp: https://en.wikipedia.org/wiki/webp
- any: Evaluates all of the above mentioned formats on export
Declaration
Swift
public enum ExportableFormat : ExportableFormatter
-
The type of
See moreFriendlyFez
.Declaration
Swift
public enum FezType : String, CaseIterable, Codable
-
Represents errors that can be thrown within the SwiftGD module.
- invalidFormat: Image raster format mismatch on import/export
- invalidImage: Contains the reason this error was thrown.
- invalidColor: Contains the reason this error was thrown.
- invalidMaxColors: Asserts sane values for creating indexed Images
Declaration
Swift
public enum GDError : Swift.Error
-
Internally, the Image Handler stores images at multiple sizes upon image upload. The exact sizes stored for each sizeGroup may vary based on
See moreImageUsage
. Request images at roughly the size you need.Declaration
Swift
enum ImageSizeGroup : String
-
The type of model for which an
See moreImageHandler
is processing. This defines the size of the thumbnail produced.Declaration
Swift
enum ImageUsage : String
-
Enum definition of built-in importable image raster formats
- bmp: https://en.wikipedia.org/wiki/BMP_file_format
- gif: https://en.wikipedia.org/wiki/gif
- jpg: https://en.wikipedia.org/wiki/jpeg
- png: https://en.wikipedia.org/wiki/Portable_Network_Graphics
- tiff: https://en.wikipedia.org/wiki/tiff
- tga: https://en.wikipedia.org/wiki/Truevision_TGA
- wbmp: https://en.wikipedia.org/wiki/wbmp
- webp: https://en.wikipedia.org/wiki/webp
- any: Evaluates all of the above mentioned formats on import
Declaration
Swift
public enum ImportableFormat : ImportableFormatter
-
Describes the type of action a moderator took. This enum is used both in the ModeratorAction Model, and in several Moderation DTOs. Be careful when modifying this. Not all ModeratorActionTypes are applicable to all ReportTypes.
See moreDeclaration
Swift
public enum ModeratorActionType : String, Codable
-
A type of event that can change the value of the global notification handler’s
UserNotificationData
result.When certain database-mutating events occur, the notification bookkeeping methods need to be called to keep our cached notification counts up to date. The notification counts themselves are database-denormalizing, but they’re a cache intended to improve the performance of the global notification method.
How notifications are stored in Redis:
- Announcements:
ActiveAnnouncementIDs
holds announcement IDs for all active announcements, Its updated frequently to catch expiring announcements. - Mentions: Fields
twarrtMention
andforumMention
in hash-valued keyNotificationHash-\(userID)
hold the total number of @mentions for each user–this should be equal to the # of results a text search for@<username>
will return. Counts are updated on each post, post edit, and post deletion. - Alertwords: All alertwords by all users are kept in a sorted set keyed by
alertwords
. The value for each entry in the set is the number of users watching on that alertword. When someone posts, we get all fields inalertwords
with values > 0. We then intersect the words in the post with the words from alertwords. For any words in the intersection, we get the set-valued keyalertwordusers-\(word)
to get the set of users watching on that particular word. We then increment the count of the fieldalertwordTweet-\(word)
in keyNotificationHash-\(userID)
. - Fez Posts/Seamails: When a post is created, we increment a field named with the fezzes’ ID in the
UnreadFezzes-\(userID)
orUnreadSeamails-\(userID)
key. When a post is deleted, we decrement the same field, only for users that haven’t seen the post (their unseen count is less than how far back the deleted post is). - Next Event Time: Every time an event is followed/unfollowed, we calculate the time of the next event in the followed list, storing that in the
nextFollowedEventTime
field inNotificationHash-\(userID)
.
How notifications are marked ‘viewed’ in Redis:
- Announcements: Each user stores the # of their highest-read announcement in the
announcement
field of the hash-valued keyNotificationHash-\(userID)
. The number of announcements with IDs > the highest-read announceemnt are ‘new’ to that user. This means an announceement could appear and then expire unseen by a user, and their unseen count would continue to be correct. - Mentions: The # of mentions the user has viewed are stored in
twarrtMention_viewed
in theNotificationHash-\(userID)
key, and set equal to the relevant @mention count when a user’s own mentions are viewed (that is, twarrts/posts are requested with a query ofmentionSelf
or similar). - Alertwords: Similar to Mentions; the # of alertword hits that have been viewed is stored in
alertwordTweet-\(word)_viewed
. The difference between this field andalertwordTweet-\(word)
equals the number of new, unseen alertword hits. The_viewed
field is set equal to the count field upon viewing hits. - Fez Posts: When the fez is viewed (more corectly, the getSingleFez api call is made), we set the # of unseen posts for the fez to 0.
- Next Event Time: Never gets deleted, but can get expired when the current time is > the event time.
Declaration
Swift
enum NotificationType
- Announcements:
-
Declaration
Swift
public enum ReportType : String, Codable
-
Names of clients that consume the Swiftarr client API. Used in the
See moreSettingsAppFeaturePair
struct. Clients: Be sure to anticipate server values not listed here.Declaration
Swift
public enum SwiftarrClientApp : String, Content, CaseIterable
-
Functional areas of the Swiftarr API. Used in the
See moreSettingsAppFeaturePair
struct. Clients: Be sure to anticipate server values not listed here.Declaration
Swift
public enum SwiftarrFeature : String, Content, CaseIterable
-
All API endpoints are protected by a minimum user access level. This
See moreenum
structure MUST match the values inCreateCustomEnums
in SchemaCreation.swift as this enum is part of the database schema. This enum is also sent out in several Data Transfer Object types. Think very carefully about modifying these values.Declaration
Swift
public enum UserAccessLevel : String, Codable, Sendable
extension UserAccessLevel: Comparable
extension UserAccessLevel: RESPValueConvertible
-
UserRole is a simple role-based access control mechanism mostly used for elevating ‘verified’ users to have specific extra access. UserRole is therefore an access model that works in addition to Twitarr’s priority access model (see
UserLevel
). With UserLevlels, each increasing access level is a superset of access provided by the previous level. Roles allow multiple users to each extend theverified
permissions without one of the extensions always being a superset of the other.This implementation is not a full RBAC. Instead: - Each user may have multiple roles - A db object or API call that requires a role to use must test that the requesting user has the proper role. - Roles implicitly define permissions; there is no facility to add/remove permissions from roles. - There is no role hierarchy. An operation X that allows X_User and X_Manager to access it must test for both roles explicitly. - Ideally, a DB object that requires a role to access should only require one role be stored for it. - In general, a nil value for a DB object’s
See morerequiredRole
should mean no special role is required to access it. - Moderators and above should usually have access to role-protected content; without us having to add a bunch of roles to each moderator user.Declaration
Swift
public enum UserRoleType : String, CaseIterable, Codable, Sendable