diff --git a/frontend-reactive/app/models/role.ts b/frontend-reactive/app/models/role.ts new file mode 100644 index 0000000..5ff3e0b --- /dev/null +++ b/frontend-reactive/app/models/role.ts @@ -0,0 +1,58 @@ +// Code generated by cmd/RolesApiTypeGenerator DO NOT EDIT. +// If you need to refresh the content, run go generate again +import Model, { attr } from '@ember-data/model'; + +export default class RoleModel extends Model { + @attr() declare createdAt: Date + @attr() declare updatedAt: Date + @attr() declare name: string + @attr() declare priority: number + @attr() declare isUserRole: boolean + @attr() declare isBuiltIn: boolean + + @attr() declare canSendMedia?: boolean + @attr() declare canSendFollowerOnlyNotes?: boolean + @attr() declare canIncludeLinks?: boolean + @attr() declare hasMentionCountLimit?: boolean + @attr() declare scanCreatedFollowerOnlyNotes?: boolean + @attr() declare canAffectOtherAdmins?: boolean + @attr() declare canConfirmWithheldNotes?: boolean + @attr() declare canSendCustomEmotes?: boolean + @attr() declare scanCreatedLocalNotes?: boolean + @attr() declare canOverwriteDisplayNames?: boolean + @attr() declare canRecoverDeletedNotes?: boolean + @attr() declare canManageAds?: boolean + @attr() declare canFederateBsky?: boolean + @attr() declare autoCwPostsText?: string + @attr() declare scanCreatedPublicNotes?: boolean + @attr() declare withholdNotesForManualApproval?: boolean + @attr() declare canSendReplies?: boolean + @attr() declare autoNsfwMedia?: boolean + @attr() declare canSendCustomReactions?: boolean + @attr() declare canSendLocalNotes?: boolean + @attr() declare canSendPrivateNotes?: boolean + @attr() declare canFederateFedi?: boolean + @attr() declare withholdNotesBasedOnRegex?: boolean + @attr() declare fullAdmin?: boolean + @attr() declare canSendAnnouncements?: boolean + @attr() declare canQuote?: boolean + @attr() declare canIncludeSurvey?: boolean + @attr() declare canChangeDisplayName?: boolean + @attr() declare blockedUsers?: Array + @attr() declare canMentionOthers?: boolean + @attr() declare autoCwPosts?: boolean + @attr() declare canSendPublicNotes?: boolean + @attr() declare mentionLimit?: number + @attr() declare scanCreatedPrivateNotes?: boolean + @attr() declare withholdNotesRegexes?: Array + @attr() declare canAssignRoles?: boolean + @attr() declare canSupressInteractionsBetweenUsers?: boolean + @attr() declare canManageCustomEmotes?: boolean + @attr() declare canViewDeletedNotes?: boolean + @attr() declare canBoost?: boolean + @attr() declare canSubmitReports?: boolean + @attr() declare canLogin?: boolean + @attr() declare disallowInteractionsWith?: Array + @attr() declare canDeleteNotes?: boolean + @attr() declare canManageAvatarDecorations?: boolean +} \ No newline at end of file diff --git a/server/apiLinstromTypeHelpers_generated.go b/server/apiLinstromTypeHelpers_generated.go new file mode 100644 index 0000000..468ffef --- /dev/null +++ b/server/apiLinstromTypeHelpers_generated.go @@ -0,0 +1,8 @@ +// Code generated by cmd/RolesApiConverter DO NOT EDIT. +// If you need to refresh the content, run go generate again +package server + +import "gitlab.com/mstarongitlab/linstrom/storage" +func convertRoleStorageToLinstrom(r storage.Role) linstromRole { +return linstromRole{Id:r.ID,CreatedAt:r.CreatedAt,UpdatedAt:r.UpdatedAt,Name:r.Name,Priority:r.Priority,IsUserRole:r.IsUserRole,IsBuiltIn:r.IsBuiltIn,CanSendAnnouncements:r.CanSendAnnouncements,CanIncludeSurvey:r.CanIncludeSurvey,CanSubmitReports:r.CanSubmitReports,CanMentionOthers:r.CanMentionOthers,WithholdNotesBasedOnRegex:r.WithholdNotesBasedOnRegex,CanSendMedia:r.CanSendMedia,CanSendLocalNotes:r.CanSendLocalNotes,ScanCreatedFollowerOnlyNotes:r.ScanCreatedFollowerOnlyNotes,CanOverwriteDisplayNames:r.CanOverwriteDisplayNames,CanDeleteNotes:r.CanDeleteNotes,CanSupressInteractionsBetweenUsers:r.CanSupressInteractionsBetweenUsers,CanManageAds:r.CanManageAds,BlockedUsers:r.BlockedUsers,CanLogin:r.CanLogin,AutoCwPosts:r.AutoCwPosts,WithholdNotesRegexes:r.WithholdNotesRegexes,ScanCreatedPublicNotes:r.ScanCreatedPublicNotes,ScanCreatedLocalNotes:r.ScanCreatedLocalNotes,CanAffectOtherAdmins:r.CanAffectOtherAdmins,CanAssignRoles:r.CanAssignRoles,CanSendFollowerOnlyNotes:r.CanSendFollowerOnlyNotes,CanBoost:r.CanBoost,CanFederateBsky:r.CanFederateBsky,HasMentionCountLimit:r.HasMentionCountLimit,DisallowInteractionsWith:r.DisallowInteractionsWith,CanViewDeletedNotes:r.CanViewDeletedNotes,CanSendCustomReactions:r.CanSendCustomReactions,CanSendReplies:r.CanSendReplies,CanIncludeLinks:r.CanIncludeLinks,CanChangeDisplayName:r.CanChangeDisplayName,CanSendPrivateNotes:r.CanSendPrivateNotes,MentionLimit:r.MentionLimit,WithholdNotesForManualApproval:r.WithholdNotesForManualApproval,CanRecoverDeletedNotes:r.CanRecoverDeletedNotes,AutoCwPostsText:r.AutoCwPostsText,ScanCreatedPrivateNotes:r.ScanCreatedPrivateNotes,CanSendCustomEmotes:r.CanSendCustomEmotes,CanSendPublicNotes:r.CanSendPublicNotes,CanQuote:r.CanQuote,CanFederateFedi:r.CanFederateFedi,CanManageAvatarDecorations:r.CanManageAvatarDecorations,AutoNsfwMedia:r.AutoNsfwMedia,FullAdmin:r.FullAdmin,CanConfirmWithheldNotes:r.CanConfirmWithheldNotes,CanManageCustomEmotes:r.CanManageCustomEmotes,} +} diff --git a/server/apiLinstromTypes_generated.go b/server/apiLinstromTypes_generated.go new file mode 100644 index 0000000..fe99fec --- /dev/null +++ b/server/apiLinstromTypes_generated.go @@ -0,0 +1,59 @@ +// Code generated by cmd/RolesApiTypeGenerator DO NOT EDIT. +// If you need to refresh the content, run go generate again +package server + +import "time" +type linstromRole struct { + Id uint `jsonapi:"primary,roles"` + CreatedAt time.Time `jsonapi:"attr,created-at"` + UpdatedAt time.Time `jsonapi:"attr,updated-at"` + Name string `jsonapi:"attr,name"` + Priority uint32 `jsonapi:"attr,priority"` + IsUserRole bool `jsonapi:"attr,is-user-role"` + IsBuiltIn bool `jsonapi:"attr,is-built-in"` + CanQuote *bool `jsonapi:"attr,can-quote"` + CanFederateFedi *bool `jsonapi:"attr,can-federate-fedi"` + DisallowInteractionsWith []string `jsonapi:"attr,disallow-interactions-with"` + WithholdNotesRegexes []string `jsonapi:"attr,withhold-notes-regexes"` + FullAdmin *bool `jsonapi:"attr,full-admin"` + CanViewDeletedNotes *bool `jsonapi:"attr,can-view-deleted-notes"` + CanSendCustomReactions *bool `jsonapi:"attr,can-send-custom-reactions"` + CanSendFollowerOnlyNotes *bool `jsonapi:"attr,can-send-follower-only-notes"` + CanLogin *bool `jsonapi:"attr,can-login"` + AutoCwPostsText *string `jsonapi:"attr,auto-cw-posts-text"` + WithholdNotesForManualApproval *bool `jsonapi:"attr,withhold-notes-for-manual-approval"` + CanDeleteNotes *bool `jsonapi:"attr,can-delete-notes"` + CanSendLocalNotes *bool `jsonapi:"attr,can-send-local-notes"` + CanIncludeLinks *bool `jsonapi:"attr,can-include-links"` + AutoCwPosts *bool `jsonapi:"attr,auto-cw-posts"` + WithholdNotesBasedOnRegex *bool `jsonapi:"attr,withhold-notes-based-on-regex"` + CanAffectOtherAdmins *bool `jsonapi:"attr,can-affect-other-admins"` + CanAssignRoles *bool `jsonapi:"attr,can-assign-roles"` + CanSendMedia *bool `jsonapi:"attr,can-send-media"` + BlockedUsers []string `jsonapi:"attr,blocked-users"` + AutoNsfwMedia *bool `jsonapi:"attr,auto-nsfw-media"` + CanConfirmWithheldNotes *bool `jsonapi:"attr,can-confirm-withheld-notes"` + CanOverwriteDisplayNames *bool `jsonapi:"attr,can-overwrite-display-names"` + CanManageAds *bool `jsonapi:"attr,can-manage-ads"` + CanIncludeSurvey *bool `jsonapi:"attr,can-include-survey"` + CanSubmitReports *bool `jsonapi:"attr,can-submit-reports"` + ScanCreatedFollowerOnlyNotes *bool `jsonapi:"attr,scan-created-follower-only-notes"` + CanManageCustomEmotes *bool `jsonapi:"attr,can-manage-custom-emotes"` + CanManageAvatarDecorations *bool `jsonapi:"attr,can-manage-avatar-decorations"` + CanSendAnnouncements *bool `jsonapi:"attr,can-send-announcements"` + CanBoost *bool `jsonapi:"attr,can-boost"` + ScanCreatedPublicNotes *bool `jsonapi:"attr,scan-created-public-notes"` + HasMentionCountLimit *bool `jsonapi:"attr,has-mention-count-limit"` + MentionLimit *uint32 `jsonapi:"attr,mention-limit"` + CanSendCustomEmotes *bool `jsonapi:"attr,can-send-custom-emotes"` + CanChangeDisplayName *bool `jsonapi:"attr,can-change-display-name"` + ScanCreatedLocalNotes *bool `jsonapi:"attr,scan-created-local-notes"` + CanSupressInteractionsBetweenUsers *bool `jsonapi:"attr,can-supress-interactions-between-users"` + CanSendReplies *bool `jsonapi:"attr,can-send-replies"` + CanFederateBsky *bool `jsonapi:"attr,can-federate-bsky"` + CanMentionOthers *bool `jsonapi:"attr,can-mention-others"` + ScanCreatedPrivateNotes *bool `jsonapi:"attr,scan-created-private-notes"` + CanRecoverDeletedNotes *bool `jsonapi:"attr,can-recover-deleted-notes"` + CanSendPublicNotes *bool `jsonapi:"attr,can-send-public-notes"` + CanSendPrivateNotes *bool `jsonapi:"attr,can-send-private-notes"` +} \ No newline at end of file diff --git a/storage/rolesUtil_generated.go b/storage/rolesUtil_generated.go index f73708b..2343821 100644 --- a/storage/rolesUtil_generated.go +++ b/storage/rolesUtil_generated.go @@ -11,141 +11,141 @@ func CollapseRolesIntoOne(roles ...Role) Role { startingRole := RoleDeepCopy(DefaultUserRole) slices.SortFunc(roles, func(a, b Role) int { return int(int64(a.Priority)-int64(b.Priority)) }) for _, role := range roles { - if role.CanViewDeletedNotes != nil { - *startingRole.CanViewDeletedNotes = *role.CanViewDeletedNotes - } - if role.CanSendPrivateNotes != nil { - *startingRole.CanSendPrivateNotes = *role.CanSendPrivateNotes - } - if role.CanBoost != nil { - *startingRole.CanBoost = *role.CanBoost - } - if role.BlockedUsers != nil { - startingRole.BlockedUsers = append(startingRole.BlockedUsers, role.BlockedUsers...) - } - if role.WithholdNotesRegexes != nil { - startingRole.WithholdNotesRegexes = append(startingRole.WithholdNotesRegexes, role.WithholdNotesRegexes...) - } - if role.CanSupressInteractionsBetweenUsers != nil { - *startingRole.CanSupressInteractionsBetweenUsers = *role.CanSupressInteractionsBetweenUsers - } - if role.CanManageCustomEmotes != nil { - *startingRole.CanManageCustomEmotes = *role.CanManageCustomEmotes - } - if role.CanQuote != nil { - *startingRole.CanQuote = *role.CanQuote - } - if role.CanFederateFedi != nil { - *startingRole.CanFederateFedi = *role.CanFederateFedi - } - if role.CanFederateBsky != nil { - *startingRole.CanFederateBsky = *role.CanFederateBsky - } - if role.CanSendLocalNotes != nil { - *startingRole.CanSendLocalNotes = *role.CanSendLocalNotes - } - if role.AutoCwPosts != nil { - *startingRole.AutoCwPosts = *role.AutoCwPosts - } - if role.DisallowInteractionsWith != nil { - startingRole.DisallowInteractionsWith = append(startingRole.DisallowInteractionsWith, role.DisallowInteractionsWith...) - } - if role.CanSendMedia != nil { - *startingRole.CanSendMedia = *role.CanSendMedia - } - if role.CanSendCustomEmotes != nil { - *startingRole.CanSendCustomEmotes = *role.CanSendCustomEmotes - } - if role.CanSendCustomReactions != nil { - *startingRole.CanSendCustomReactions = *role.CanSendCustomReactions - } - if role.MentionLimit != nil { - *startingRole.MentionLimit = *role.MentionLimit - } - if role.AutoNsfwMedia != nil { - *startingRole.AutoNsfwMedia = *role.AutoNsfwMedia - } - if role.ScanCreatedLocalNotes != nil { - *startingRole.ScanCreatedLocalNotes = *role.ScanCreatedLocalNotes - } - if role.CanAffectOtherAdmins != nil { - *startingRole.CanAffectOtherAdmins = *role.CanAffectOtherAdmins - } - if role.CanRecoverDeletedNotes != nil { - *startingRole.CanRecoverDeletedNotes = *role.CanRecoverDeletedNotes - } - if role.CanSendPublicNotes != nil { - *startingRole.CanSendPublicNotes = *role.CanSendPublicNotes + if role.WithholdNotesForManualApproval != nil { + *startingRole.WithholdNotesForManualApproval = *role.WithholdNotesForManualApproval } if role.CanIncludeLinks != nil { *startingRole.CanIncludeLinks = *role.CanIncludeLinks } - if role.CanLogin != nil { - *startingRole.CanLogin = *role.CanLogin - } - if role.CanManageAvatarDecorations != nil { - *startingRole.CanManageAvatarDecorations = *role.CanManageAvatarDecorations - } - if role.ScanCreatedPrivateNotes != nil { - *startingRole.ScanCreatedPrivateNotes = *role.ScanCreatedPrivateNotes - } - if role.FullAdmin != nil { - *startingRole.FullAdmin = *role.FullAdmin - } - if role.CanOverwriteDisplayNames != nil { - *startingRole.CanOverwriteDisplayNames = *role.CanOverwriteDisplayNames - } - if role.CanSendFollowerOnlyNotes != nil { - *startingRole.CanSendFollowerOnlyNotes = *role.CanSendFollowerOnlyNotes - } - if role.CanChangeDisplayName != nil { - *startingRole.CanChangeDisplayName = *role.CanChangeDisplayName - } - if role.AutoCwPostsText != nil { - *startingRole.AutoCwPostsText = *role.AutoCwPostsText - } - if role.WithholdNotesForManualApproval != nil { - *startingRole.WithholdNotesForManualApproval = *role.WithholdNotesForManualApproval - } - if role.CanDeleteNotes != nil { - *startingRole.CanDeleteNotes = *role.CanDeleteNotes - } - if role.CanSubmitReports != nil { - *startingRole.CanSubmitReports = *role.CanSubmitReports + if role.BlockedUsers != nil { + startingRole.BlockedUsers = append(startingRole.BlockedUsers, role.BlockedUsers...) } if role.HasMentionCountLimit != nil { *startingRole.HasMentionCountLimit = *role.HasMentionCountLimit } - if role.ScanCreatedFollowerOnlyNotes != nil { - *startingRole.ScanCreatedFollowerOnlyNotes = *role.ScanCreatedFollowerOnlyNotes - } - if role.CanSendAnnouncements != nil { - *startingRole.CanSendAnnouncements = *role.CanSendAnnouncements - } - if role.CanIncludeSurvey != nil { - *startingRole.CanIncludeSurvey = *role.CanIncludeSurvey + if role.MentionLimit != nil { + *startingRole.MentionLimit = *role.MentionLimit } if role.ScanCreatedPublicNotes != nil { *startingRole.ScanCreatedPublicNotes = *role.ScanCreatedPublicNotes } - if role.WithholdNotesBasedOnRegex != nil { - *startingRole.WithholdNotesBasedOnRegex = *role.WithholdNotesBasedOnRegex + if role.AutoNsfwMedia != nil { + *startingRole.AutoNsfwMedia = *role.AutoNsfwMedia } - if role.CanAssignRoles != nil { - *startingRole.CanAssignRoles = *role.CanAssignRoles + if role.CanAffectOtherAdmins != nil { + *startingRole.CanAffectOtherAdmins = *role.CanAffectOtherAdmins } - if role.CanManageAds != nil { - *startingRole.CanManageAds = *role.CanManageAds + if role.CanViewDeletedNotes != nil { + *startingRole.CanViewDeletedNotes = *role.CanViewDeletedNotes + } + if role.CanSupressInteractionsBetweenUsers != nil { + *startingRole.CanSupressInteractionsBetweenUsers = *role.CanSupressInteractionsBetweenUsers + } + if role.CanSendLocalNotes != nil { + *startingRole.CanSendLocalNotes = *role.CanSendLocalNotes + } + if role.CanFederateBsky != nil { + *startingRole.CanFederateBsky = *role.CanFederateBsky + } + if role.AutoCwPosts != nil { + *startingRole.AutoCwPosts = *role.AutoCwPosts + } + if role.ScanCreatedPrivateNotes != nil { + *startingRole.ScanCreatedPrivateNotes = *role.ScanCreatedPrivateNotes + } + if role.CanDeleteNotes != nil { + *startingRole.CanDeleteNotes = *role.CanDeleteNotes + } + if role.CanSendCustomEmotes != nil { + *startingRole.CanSendCustomEmotes = *role.CanSendCustomEmotes + } + if role.CanIncludeSurvey != nil { + *startingRole.CanIncludeSurvey = *role.CanIncludeSurvey + } + if role.ScanCreatedLocalNotes != nil { + *startingRole.ScanCreatedLocalNotes = *role.ScanCreatedLocalNotes + } + if role.ScanCreatedFollowerOnlyNotes != nil { + *startingRole.ScanCreatedFollowerOnlyNotes = *role.ScanCreatedFollowerOnlyNotes + } + if role.CanOverwriteDisplayNames != nil { + *startingRole.CanOverwriteDisplayNames = *role.CanOverwriteDisplayNames + } + if role.AutoCwPostsText != nil { + *startingRole.AutoCwPostsText = *role.AutoCwPostsText + } + if role.DisallowInteractionsWith != nil { + startingRole.DisallowInteractionsWith = append(startingRole.DisallowInteractionsWith, role.DisallowInteractionsWith...) + } + if role.CanRecoverDeletedNotes != nil { + *startingRole.CanRecoverDeletedNotes = *role.CanRecoverDeletedNotes + } + if role.CanSendFollowerOnlyNotes != nil { + *startingRole.CanSendFollowerOnlyNotes = *role.CanSendFollowerOnlyNotes + } + if role.CanSendPrivateNotes != nil { + *startingRole.CanSendPrivateNotes = *role.CanSendPrivateNotes } if role.CanSendReplies != nil { *startingRole.CanSendReplies = *role.CanSendReplies } + if role.CanChangeDisplayName != nil { + *startingRole.CanChangeDisplayName = *role.CanChangeDisplayName + } if role.CanMentionOthers != nil { *startingRole.CanMentionOthers = *role.CanMentionOthers } + if role.CanManageAds != nil { + *startingRole.CanManageAds = *role.CanManageAds + } + if role.CanSendMedia != nil { + *startingRole.CanSendMedia = *role.CanSendMedia + } + if role.CanQuote != nil { + *startingRole.CanQuote = *role.CanQuote + } + if role.CanBoost != nil { + *startingRole.CanBoost = *role.CanBoost + } + if role.WithholdNotesBasedOnRegex != nil { + *startingRole.WithholdNotesBasedOnRegex = *role.WithholdNotesBasedOnRegex + } + if role.WithholdNotesRegexes != nil { + startingRole.WithholdNotesRegexes = append(startingRole.WithholdNotesRegexes, role.WithholdNotesRegexes...) + } + if role.CanManageCustomEmotes != nil { + *startingRole.CanManageCustomEmotes = *role.CanManageCustomEmotes + } + if role.CanSendAnnouncements != nil { + *startingRole.CanSendAnnouncements = *role.CanSendAnnouncements + } + if role.CanSendCustomReactions != nil { + *startingRole.CanSendCustomReactions = *role.CanSendCustomReactions + } + if role.CanFederateFedi != nil { + *startingRole.CanFederateFedi = *role.CanFederateFedi + } + if role.CanSubmitReports != nil { + *startingRole.CanSubmitReports = *role.CanSubmitReports + } + if role.CanLogin != nil { + *startingRole.CanLogin = *role.CanLogin + } + if role.CanAssignRoles != nil { + *startingRole.CanAssignRoles = *role.CanAssignRoles + } + if role.CanSendPublicNotes != nil { + *startingRole.CanSendPublicNotes = *role.CanSendPublicNotes + } + if role.FullAdmin != nil { + *startingRole.FullAdmin = *role.FullAdmin + } if role.CanConfirmWithheldNotes != nil { *startingRole.CanConfirmWithheldNotes = *role.CanConfirmWithheldNotes } + if role.CanManageAvatarDecorations != nil { + *startingRole.CanManageAvatarDecorations = *role.CanManageAvatarDecorations + } } return startingRole } @@ -157,180 +157,180 @@ func RoleDeepCopy(o Role) Role { n.Priority = o.Priority n.IsUserRole = o.IsUserRole n.IsBuiltIn = o.IsBuiltIn - if o.AutoNsfwMedia == nil { n.AutoNsfwMedia = nil } else { - t := *o.AutoNsfwMedia - n.AutoNsfwMedia = &t - } - if o.ScanCreatedLocalNotes == nil { n.ScanCreatedLocalNotes = nil } else { - t := *o.ScanCreatedLocalNotes - n.ScanCreatedLocalNotes = &t - } - if o.CanAffectOtherAdmins == nil { n.CanAffectOtherAdmins = nil } else { - t := *o.CanAffectOtherAdmins - n.CanAffectOtherAdmins = &t - } - if o.CanRecoverDeletedNotes == nil { n.CanRecoverDeletedNotes = nil } else { - t := *o.CanRecoverDeletedNotes - n.CanRecoverDeletedNotes = &t - } if o.CanSendPublicNotes == nil { n.CanSendPublicNotes = nil } else { t := *o.CanSendPublicNotes n.CanSendPublicNotes = &t } - if o.CanIncludeLinks == nil { n.CanIncludeLinks = nil } else { - t := *o.CanIncludeLinks - n.CanIncludeLinks = &t - } - if o.CanLogin == nil { n.CanLogin = nil } else { - t := *o.CanLogin - n.CanLogin = &t - } - if o.MentionLimit == nil { n.MentionLimit = nil } else { - t := *o.MentionLimit - n.MentionLimit = &t - } - if o.CanManageAvatarDecorations == nil { n.CanManageAvatarDecorations = nil } else { - t := *o.CanManageAvatarDecorations - n.CanManageAvatarDecorations = &t - } if o.FullAdmin == nil { n.FullAdmin = nil } else { t := *o.FullAdmin n.FullAdmin = &t } - if o.CanOverwriteDisplayNames == nil { n.CanOverwriteDisplayNames = nil } else { - t := *o.CanOverwriteDisplayNames - n.CanOverwriteDisplayNames = &t + if o.CanConfirmWithheldNotes == nil { n.CanConfirmWithheldNotes = nil } else { + t := *o.CanConfirmWithheldNotes + n.CanConfirmWithheldNotes = &t } - if o.CanSendFollowerOnlyNotes == nil { n.CanSendFollowerOnlyNotes = nil } else { - t := *o.CanSendFollowerOnlyNotes - n.CanSendFollowerOnlyNotes = &t - } - if o.CanChangeDisplayName == nil { n.CanChangeDisplayName = nil } else { - t := *o.CanChangeDisplayName - n.CanChangeDisplayName = &t - } - if o.AutoCwPostsText == nil { n.AutoCwPostsText = nil } else { - t := *o.AutoCwPostsText - n.AutoCwPostsText = &t - } - if o.ScanCreatedPrivateNotes == nil { n.ScanCreatedPrivateNotes = nil } else { - t := *o.ScanCreatedPrivateNotes - n.ScanCreatedPrivateNotes = &t - } - if o.CanDeleteNotes == nil { n.CanDeleteNotes = nil } else { - t := *o.CanDeleteNotes - n.CanDeleteNotes = &t - } - if o.CanSubmitReports == nil { n.CanSubmitReports = nil } else { - t := *o.CanSubmitReports - n.CanSubmitReports = &t - } - if o.HasMentionCountLimit == nil { n.HasMentionCountLimit = nil } else { - t := *o.HasMentionCountLimit - n.HasMentionCountLimit = &t - } - if o.ScanCreatedFollowerOnlyNotes == nil { n.ScanCreatedFollowerOnlyNotes = nil } else { - t := *o.ScanCreatedFollowerOnlyNotes - n.ScanCreatedFollowerOnlyNotes = &t - } - if o.WithholdNotesForManualApproval == nil { n.WithholdNotesForManualApproval = nil } else { - t := *o.WithholdNotesForManualApproval - n.WithholdNotesForManualApproval = &t - } - if o.CanIncludeSurvey == nil { n.CanIncludeSurvey = nil } else { - t := *o.CanIncludeSurvey - n.CanIncludeSurvey = &t + if o.CanManageAvatarDecorations == nil { n.CanManageAvatarDecorations = nil } else { + t := *o.CanManageAvatarDecorations + n.CanManageAvatarDecorations = &t } if o.ScanCreatedPublicNotes == nil { n.ScanCreatedPublicNotes = nil } else { t := *o.ScanCreatedPublicNotes n.ScanCreatedPublicNotes = &t } - if o.WithholdNotesBasedOnRegex == nil { n.WithholdNotesBasedOnRegex = nil } else { - t := *o.WithholdNotesBasedOnRegex - n.WithholdNotesBasedOnRegex = &t + if o.WithholdNotesForManualApproval == nil { n.WithholdNotesForManualApproval = nil } else { + t := *o.WithholdNotesForManualApproval + n.WithholdNotesForManualApproval = &t } - if o.CanSendAnnouncements == nil { n.CanSendAnnouncements = nil } else { - t := *o.CanSendAnnouncements - n.CanSendAnnouncements = &t - } - if o.CanManageAds == nil { n.CanManageAds = nil } else { - t := *o.CanManageAds - n.CanManageAds = &t - } - if o.CanSendReplies == nil { n.CanSendReplies = nil } else { - t := *o.CanSendReplies - n.CanSendReplies = &t - } - if o.CanMentionOthers == nil { n.CanMentionOthers = nil } else { - t := *o.CanMentionOthers - n.CanMentionOthers = &t - } - if o.CanConfirmWithheldNotes == nil { n.CanConfirmWithheldNotes = nil } else { - t := *o.CanConfirmWithheldNotes - n.CanConfirmWithheldNotes = &t - } - if o.CanAssignRoles == nil { n.CanAssignRoles = nil } else { - t := *o.CanAssignRoles - n.CanAssignRoles = &t - } - if o.CanSendPrivateNotes == nil { n.CanSendPrivateNotes = nil } else { - t := *o.CanSendPrivateNotes - n.CanSendPrivateNotes = &t - } - if o.CanBoost == nil { n.CanBoost = nil } else { - t := *o.CanBoost - n.CanBoost = &t + if o.CanIncludeLinks == nil { n.CanIncludeLinks = nil } else { + t := *o.CanIncludeLinks + n.CanIncludeLinks = &t } n.BlockedUsers = slices.Clone(o.BlockedUsers) + if o.HasMentionCountLimit == nil { n.HasMentionCountLimit = nil } else { + t := *o.HasMentionCountLimit + n.HasMentionCountLimit = &t + } + if o.MentionLimit == nil { n.MentionLimit = nil } else { + t := *o.MentionLimit + n.MentionLimit = &t + } + if o.AutoNsfwMedia == nil { n.AutoNsfwMedia = nil } else { + t := *o.AutoNsfwMedia + n.AutoNsfwMedia = &t + } + if o.CanAffectOtherAdmins == nil { n.CanAffectOtherAdmins = nil } else { + t := *o.CanAffectOtherAdmins + n.CanAffectOtherAdmins = &t + } if o.CanViewDeletedNotes == nil { n.CanViewDeletedNotes = nil } else { t := *o.CanViewDeletedNotes n.CanViewDeletedNotes = &t } + if o.CanDeleteNotes == nil { n.CanDeleteNotes = nil } else { + t := *o.CanDeleteNotes + n.CanDeleteNotes = &t + } if o.CanSupressInteractionsBetweenUsers == nil { n.CanSupressInteractionsBetweenUsers = nil } else { t := *o.CanSupressInteractionsBetweenUsers n.CanSupressInteractionsBetweenUsers = &t } - if o.CanManageCustomEmotes == nil { n.CanManageCustomEmotes = nil } else { - t := *o.CanManageCustomEmotes - n.CanManageCustomEmotes = &t - } - if o.CanQuote == nil { n.CanQuote = nil } else { - t := *o.CanQuote - n.CanQuote = &t - } - if o.CanFederateFedi == nil { n.CanFederateFedi = nil } else { - t := *o.CanFederateFedi - n.CanFederateFedi = &t + if o.CanSendLocalNotes == nil { n.CanSendLocalNotes = nil } else { + t := *o.CanSendLocalNotes + n.CanSendLocalNotes = &t } if o.CanFederateBsky == nil { n.CanFederateBsky = nil } else { t := *o.CanFederateBsky n.CanFederateBsky = &t } - n.WithholdNotesRegexes = slices.Clone(o.WithholdNotesRegexes) if o.AutoCwPosts == nil { n.AutoCwPosts = nil } else { t := *o.AutoCwPosts n.AutoCwPosts = &t } - n.DisallowInteractionsWith = slices.Clone(o.DisallowInteractionsWith) - if o.CanSendMedia == nil { n.CanSendMedia = nil } else { - t := *o.CanSendMedia - n.CanSendMedia = &t + if o.ScanCreatedPrivateNotes == nil { n.ScanCreatedPrivateNotes = nil } else { + t := *o.ScanCreatedPrivateNotes + n.ScanCreatedPrivateNotes = &t + } + if o.CanOverwriteDisplayNames == nil { n.CanOverwriteDisplayNames = nil } else { + t := *o.CanOverwriteDisplayNames + n.CanOverwriteDisplayNames = &t } if o.CanSendCustomEmotes == nil { n.CanSendCustomEmotes = nil } else { t := *o.CanSendCustomEmotes n.CanSendCustomEmotes = &t } + if o.CanIncludeSurvey == nil { n.CanIncludeSurvey = nil } else { + t := *o.CanIncludeSurvey + n.CanIncludeSurvey = &t + } + if o.ScanCreatedLocalNotes == nil { n.ScanCreatedLocalNotes = nil } else { + t := *o.ScanCreatedLocalNotes + n.ScanCreatedLocalNotes = &t + } + if o.ScanCreatedFollowerOnlyNotes == nil { n.ScanCreatedFollowerOnlyNotes = nil } else { + t := *o.ScanCreatedFollowerOnlyNotes + n.ScanCreatedFollowerOnlyNotes = &t + } + if o.CanMentionOthers == nil { n.CanMentionOthers = nil } else { + t := *o.CanMentionOthers + n.CanMentionOthers = &t + } + if o.AutoCwPostsText == nil { n.AutoCwPostsText = nil } else { + t := *o.AutoCwPostsText + n.AutoCwPostsText = &t + } + n.DisallowInteractionsWith = slices.Clone(o.DisallowInteractionsWith) + if o.CanRecoverDeletedNotes == nil { n.CanRecoverDeletedNotes = nil } else { + t := *o.CanRecoverDeletedNotes + n.CanRecoverDeletedNotes = &t + } + if o.CanSendFollowerOnlyNotes == nil { n.CanSendFollowerOnlyNotes = nil } else { + t := *o.CanSendFollowerOnlyNotes + n.CanSendFollowerOnlyNotes = &t + } + if o.CanSendPrivateNotes == nil { n.CanSendPrivateNotes = nil } else { + t := *o.CanSendPrivateNotes + n.CanSendPrivateNotes = &t + } + if o.CanSendReplies == nil { n.CanSendReplies = nil } else { + t := *o.CanSendReplies + n.CanSendReplies = &t + } + if o.CanChangeDisplayName == nil { n.CanChangeDisplayName = nil } else { + t := *o.CanChangeDisplayName + n.CanChangeDisplayName = &t + } + n.WithholdNotesRegexes = slices.Clone(o.WithholdNotesRegexes) + if o.CanManageAds == nil { n.CanManageAds = nil } else { + t := *o.CanManageAds + n.CanManageAds = &t + } + if o.CanSendMedia == nil { n.CanSendMedia = nil } else { + t := *o.CanSendMedia + n.CanSendMedia = &t + } + if o.CanQuote == nil { n.CanQuote = nil } else { + t := *o.CanQuote + n.CanQuote = &t + } + if o.CanBoost == nil { n.CanBoost = nil } else { + t := *o.CanBoost + n.CanBoost = &t + } + if o.WithholdNotesBasedOnRegex == nil { n.WithholdNotesBasedOnRegex = nil } else { + t := *o.WithholdNotesBasedOnRegex + n.WithholdNotesBasedOnRegex = &t + } + if o.CanAssignRoles == nil { n.CanAssignRoles = nil } else { + t := *o.CanAssignRoles + n.CanAssignRoles = &t + } + if o.CanManageCustomEmotes == nil { n.CanManageCustomEmotes = nil } else { + t := *o.CanManageCustomEmotes + n.CanManageCustomEmotes = &t + } + if o.CanSendAnnouncements == nil { n.CanSendAnnouncements = nil } else { + t := *o.CanSendAnnouncements + n.CanSendAnnouncements = &t + } if o.CanSendCustomReactions == nil { n.CanSendCustomReactions = nil } else { t := *o.CanSendCustomReactions n.CanSendCustomReactions = &t } - if o.CanSendLocalNotes == nil { n.CanSendLocalNotes = nil } else { - t := *o.CanSendLocalNotes - n.CanSendLocalNotes = &t + if o.CanFederateFedi == nil { n.CanFederateFedi = nil } else { + t := *o.CanFederateFedi + n.CanFederateFedi = &t + } + if o.CanSubmitReports == nil { n.CanSubmitReports = nil } else { + t := *o.CanSubmitReports + n.CanSubmitReports = &t + } + if o.CanLogin == nil { n.CanLogin = nil } else { + t := *o.CanLogin + n.CanLogin = &t } return n } func CompareRoles(a, b *Role) bool { - return (a.CanQuote == nil || b.CanQuote == nil || a.CanQuote == b.CanQuote) && (a.CanFederateFedi == nil || b.CanFederateFedi == nil || a.CanFederateFedi == b.CanFederateFedi) && (a.CanFederateBsky == nil || b.CanFederateBsky == nil || a.CanFederateBsky == b.CanFederateBsky) && (a.WithholdNotesRegexes == nil || b.WithholdNotesRegexes == nil || sliceutils.CompareUnordered(a.WithholdNotesRegexes,b.WithholdNotesRegexes)) && (a.CanSupressInteractionsBetweenUsers == nil || b.CanSupressInteractionsBetweenUsers == nil || a.CanSupressInteractionsBetweenUsers == b.CanSupressInteractionsBetweenUsers) && (a.CanManageCustomEmotes == nil || b.CanManageCustomEmotes == nil || a.CanManageCustomEmotes == b.CanManageCustomEmotes) && (a.CanSendMedia == nil || b.CanSendMedia == nil || a.CanSendMedia == b.CanSendMedia) && (a.CanSendCustomEmotes == nil || b.CanSendCustomEmotes == nil || a.CanSendCustomEmotes == b.CanSendCustomEmotes) && (a.CanSendCustomReactions == nil || b.CanSendCustomReactions == nil || a.CanSendCustomReactions == b.CanSendCustomReactions) && (a.CanSendLocalNotes == nil || b.CanSendLocalNotes == nil || a.CanSendLocalNotes == b.CanSendLocalNotes) && (a.AutoCwPosts == nil || b.AutoCwPosts == nil || a.AutoCwPosts == b.AutoCwPosts) && (a.DisallowInteractionsWith == nil || b.DisallowInteractionsWith == nil || sliceutils.CompareUnordered(a.DisallowInteractionsWith,b.DisallowInteractionsWith)) && (a.CanSendPublicNotes == nil || b.CanSendPublicNotes == nil || a.CanSendPublicNotes == b.CanSendPublicNotes) && (a.CanIncludeLinks == nil || b.CanIncludeLinks == nil || a.CanIncludeLinks == b.CanIncludeLinks) && (a.CanLogin == nil || b.CanLogin == nil || a.CanLogin == b.CanLogin) && (a.MentionLimit == nil || b.MentionLimit == nil || a.MentionLimit == b.MentionLimit) && (a.AutoNsfwMedia == nil || b.AutoNsfwMedia == nil || a.AutoNsfwMedia == b.AutoNsfwMedia) && (a.ScanCreatedLocalNotes == nil || b.ScanCreatedLocalNotes == nil || a.ScanCreatedLocalNotes == b.ScanCreatedLocalNotes) && (a.CanAffectOtherAdmins == nil || b.CanAffectOtherAdmins == nil || a.CanAffectOtherAdmins == b.CanAffectOtherAdmins) && (a.CanRecoverDeletedNotes == nil || b.CanRecoverDeletedNotes == nil || a.CanRecoverDeletedNotes == b.CanRecoverDeletedNotes) && (a.CanManageAvatarDecorations == nil || b.CanManageAvatarDecorations == nil || a.CanManageAvatarDecorations == b.CanManageAvatarDecorations) && (a.CanSendFollowerOnlyNotes == nil || b.CanSendFollowerOnlyNotes == nil || a.CanSendFollowerOnlyNotes == b.CanSendFollowerOnlyNotes) && (a.CanChangeDisplayName == nil || b.CanChangeDisplayName == nil || a.CanChangeDisplayName == b.CanChangeDisplayName) && (a.AutoCwPostsText == nil || b.AutoCwPostsText == nil || a.AutoCwPostsText == b.AutoCwPostsText) && (a.ScanCreatedPrivateNotes == nil || b.ScanCreatedPrivateNotes == nil || a.ScanCreatedPrivateNotes == b.ScanCreatedPrivateNotes) && (a.FullAdmin == nil || b.FullAdmin == nil || a.FullAdmin == b.FullAdmin) && (a.CanOverwriteDisplayNames == nil || b.CanOverwriteDisplayNames == nil || a.CanOverwriteDisplayNames == b.CanOverwriteDisplayNames) && (a.CanSubmitReports == nil || b.CanSubmitReports == nil || a.CanSubmitReports == b.CanSubmitReports) && (a.HasMentionCountLimit == nil || b.HasMentionCountLimit == nil || a.HasMentionCountLimit == b.HasMentionCountLimit) && (a.ScanCreatedFollowerOnlyNotes == nil || b.ScanCreatedFollowerOnlyNotes == nil || a.ScanCreatedFollowerOnlyNotes == b.ScanCreatedFollowerOnlyNotes) && (a.WithholdNotesForManualApproval == nil || b.WithholdNotesForManualApproval == nil || a.WithholdNotesForManualApproval == b.WithholdNotesForManualApproval) && (a.CanDeleteNotes == nil || b.CanDeleteNotes == nil || a.CanDeleteNotes == b.CanDeleteNotes) && (a.CanIncludeSurvey == nil || b.CanIncludeSurvey == nil || a.CanIncludeSurvey == b.CanIncludeSurvey) && (a.ScanCreatedPublicNotes == nil || b.ScanCreatedPublicNotes == nil || a.ScanCreatedPublicNotes == b.ScanCreatedPublicNotes) && (a.WithholdNotesBasedOnRegex == nil || b.WithholdNotesBasedOnRegex == nil || a.WithholdNotesBasedOnRegex == b.WithholdNotesBasedOnRegex) && (a.CanSendAnnouncements == nil || b.CanSendAnnouncements == nil || a.CanSendAnnouncements == b.CanSendAnnouncements) && (a.CanSendReplies == nil || b.CanSendReplies == nil || a.CanSendReplies == b.CanSendReplies) && (a.CanMentionOthers == nil || b.CanMentionOthers == nil || a.CanMentionOthers == b.CanMentionOthers) && (a.CanConfirmWithheldNotes == nil || b.CanConfirmWithheldNotes == nil || a.CanConfirmWithheldNotes == b.CanConfirmWithheldNotes) && (a.CanAssignRoles == nil || b.CanAssignRoles == nil || a.CanAssignRoles == b.CanAssignRoles) && (a.CanManageAds == nil || b.CanManageAds == nil || a.CanManageAds == b.CanManageAds) && (a.CanSendPrivateNotes == nil || b.CanSendPrivateNotes == nil || a.CanSendPrivateNotes == b.CanSendPrivateNotes) && (a.CanBoost == nil || b.CanBoost == nil || a.CanBoost == b.CanBoost) && (a.BlockedUsers == nil || b.BlockedUsers == nil || sliceutils.CompareUnordered(a.BlockedUsers,b.BlockedUsers)) && (a.CanViewDeletedNotes == nil || b.CanViewDeletedNotes == nil || a.CanViewDeletedNotes == b.CanViewDeletedNotes) && (a == nil || b == nil || a.CanViewDeletedNotes == b.CanViewDeletedNotes) + return (a.CanSendCustomReactions == nil || b.CanSendCustomReactions == nil || a.CanSendCustomReactions == b.CanSendCustomReactions) && (a.CanFederateFedi == nil || b.CanFederateFedi == nil || a.CanFederateFedi == b.CanFederateFedi) && (a.CanSubmitReports == nil || b.CanSubmitReports == nil || a.CanSubmitReports == b.CanSubmitReports) && (a.CanLogin == nil || b.CanLogin == nil || a.CanLogin == b.CanLogin) && (a.CanAssignRoles == nil || b.CanAssignRoles == nil || a.CanAssignRoles == b.CanAssignRoles) && (a.CanManageCustomEmotes == nil || b.CanManageCustomEmotes == nil || a.CanManageCustomEmotes == b.CanManageCustomEmotes) && (a.CanSendAnnouncements == nil || b.CanSendAnnouncements == nil || a.CanSendAnnouncements == b.CanSendAnnouncements) && (a.CanSendPublicNotes == nil || b.CanSendPublicNotes == nil || a.CanSendPublicNotes == b.CanSendPublicNotes) && (a.FullAdmin == nil || b.FullAdmin == nil || a.FullAdmin == b.FullAdmin) && (a.CanConfirmWithheldNotes == nil || b.CanConfirmWithheldNotes == nil || a.CanConfirmWithheldNotes == b.CanConfirmWithheldNotes) && (a.CanManageAvatarDecorations == nil || b.CanManageAvatarDecorations == nil || a.CanManageAvatarDecorations == b.CanManageAvatarDecorations) && (a.CanIncludeLinks == nil || b.CanIncludeLinks == nil || a.CanIncludeLinks == b.CanIncludeLinks) && (a.BlockedUsers == nil || b.BlockedUsers == nil || sliceutils.CompareUnordered(a.BlockedUsers,b.BlockedUsers)) && (a.HasMentionCountLimit == nil || b.HasMentionCountLimit == nil || a.HasMentionCountLimit == b.HasMentionCountLimit) && (a.MentionLimit == nil || b.MentionLimit == nil || a.MentionLimit == b.MentionLimit) && (a.ScanCreatedPublicNotes == nil || b.ScanCreatedPublicNotes == nil || a.ScanCreatedPublicNotes == b.ScanCreatedPublicNotes) && (a.WithholdNotesForManualApproval == nil || b.WithholdNotesForManualApproval == nil || a.WithholdNotesForManualApproval == b.WithholdNotesForManualApproval) && (a.AutoNsfwMedia == nil || b.AutoNsfwMedia == nil || a.AutoNsfwMedia == b.AutoNsfwMedia) && (a.CanAffectOtherAdmins == nil || b.CanAffectOtherAdmins == nil || a.CanAffectOtherAdmins == b.CanAffectOtherAdmins) && (a.CanViewDeletedNotes == nil || b.CanViewDeletedNotes == nil || a.CanViewDeletedNotes == b.CanViewDeletedNotes) && (a.CanSendLocalNotes == nil || b.CanSendLocalNotes == nil || a.CanSendLocalNotes == b.CanSendLocalNotes) && (a.CanFederateBsky == nil || b.CanFederateBsky == nil || a.CanFederateBsky == b.CanFederateBsky) && (a.AutoCwPosts == nil || b.AutoCwPosts == nil || a.AutoCwPosts == b.AutoCwPosts) && (a.ScanCreatedPrivateNotes == nil || b.ScanCreatedPrivateNotes == nil || a.ScanCreatedPrivateNotes == b.ScanCreatedPrivateNotes) && (a.CanDeleteNotes == nil || b.CanDeleteNotes == nil || a.CanDeleteNotes == b.CanDeleteNotes) && (a.CanSupressInteractionsBetweenUsers == nil || b.CanSupressInteractionsBetweenUsers == nil || a.CanSupressInteractionsBetweenUsers == b.CanSupressInteractionsBetweenUsers) && (a.CanSendCustomEmotes == nil || b.CanSendCustomEmotes == nil || a.CanSendCustomEmotes == b.CanSendCustomEmotes) && (a.CanIncludeSurvey == nil || b.CanIncludeSurvey == nil || a.CanIncludeSurvey == b.CanIncludeSurvey) && (a.ScanCreatedLocalNotes == nil || b.ScanCreatedLocalNotes == nil || a.ScanCreatedLocalNotes == b.ScanCreatedLocalNotes) && (a.ScanCreatedFollowerOnlyNotes == nil || b.ScanCreatedFollowerOnlyNotes == nil || a.ScanCreatedFollowerOnlyNotes == b.ScanCreatedFollowerOnlyNotes) && (a.CanOverwriteDisplayNames == nil || b.CanOverwriteDisplayNames == nil || a.CanOverwriteDisplayNames == b.CanOverwriteDisplayNames) && (a.CanRecoverDeletedNotes == nil || b.CanRecoverDeletedNotes == nil || a.CanRecoverDeletedNotes == b.CanRecoverDeletedNotes) && (a.CanSendFollowerOnlyNotes == nil || b.CanSendFollowerOnlyNotes == nil || a.CanSendFollowerOnlyNotes == b.CanSendFollowerOnlyNotes) && (a.CanSendPrivateNotes == nil || b.CanSendPrivateNotes == nil || a.CanSendPrivateNotes == b.CanSendPrivateNotes) && (a.CanSendReplies == nil || b.CanSendReplies == nil || a.CanSendReplies == b.CanSendReplies) && (a.CanChangeDisplayName == nil || b.CanChangeDisplayName == nil || a.CanChangeDisplayName == b.CanChangeDisplayName) && (a.CanMentionOthers == nil || b.CanMentionOthers == nil || a.CanMentionOthers == b.CanMentionOthers) && (a.AutoCwPostsText == nil || b.AutoCwPostsText == nil || a.AutoCwPostsText == b.AutoCwPostsText) && (a.DisallowInteractionsWith == nil || b.DisallowInteractionsWith == nil || sliceutils.CompareUnordered(a.DisallowInteractionsWith,b.DisallowInteractionsWith)) && (a.CanSendMedia == nil || b.CanSendMedia == nil || a.CanSendMedia == b.CanSendMedia) && (a.CanQuote == nil || b.CanQuote == nil || a.CanQuote == b.CanQuote) && (a.CanBoost == nil || b.CanBoost == nil || a.CanBoost == b.CanBoost) && (a.WithholdNotesBasedOnRegex == nil || b.WithholdNotesBasedOnRegex == nil || a.WithholdNotesBasedOnRegex == b.WithholdNotesBasedOnRegex) && (a.WithholdNotesRegexes == nil || b.WithholdNotesRegexes == nil || sliceutils.CompareUnordered(a.WithholdNotesRegexes,b.WithholdNotesRegexes)) && (a.CanManageAds == nil || b.CanManageAds == nil || a.CanManageAds == b.CanManageAds) && (a == nil || b == nil || a.CanManageAds == b.CanManageAds) } \ No newline at end of file