about summary refs log tree commit diff
path: root/src/lib/labeling/types.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-04-27 12:38:23 -0500
committerGitHub <noreply@github.com>2023-04-27 12:38:23 -0500
commit1d50ddb378d5c6954d4cf8a6145b4486b9497107 (patch)
tree85a55e9aef6692c304cc31d7c3bb239c186f7951 /src/lib/labeling/types.ts
parent51be8474db5e8074b1af233609b5eb455af31692 (diff)
downloadvoidsky-1d50ddb378d5c6954d4cf8a6145b4486b9497107.tar.zst
Refactor moderation to apply to accounts, profiles, and posts correctly (#548)
* Add ScreenHider component

* Add blur attribute to UserAvatar and UserBanner

* Remove dead suggested posts component and model

* Bump @atproto/api@0.2.10

* Rework moderation tooling to give a more precise DSL

* Add label mocks

* Apply finer grained moderation controls

* Refactor ProfileCard to just take the profile object

* Apply moderation to user listings and banner

* Apply moderation to notifications

* Fix lint

* Tune avatar & banner blur settings per platform

* 1.24
Diffstat (limited to 'src/lib/labeling/types.ts')
-rw-r--r--src/lib/labeling/types.ts58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/lib/labeling/types.ts b/src/lib/labeling/types.ts
new file mode 100644
index 000000000..d4efb499a
--- /dev/null
+++ b/src/lib/labeling/types.ts
@@ -0,0 +1,58 @@
+import {ComAtprotoLabelDefs} from '@atproto/api'
+import {LabelPreferencesModel} from 'state/models/ui/preferences'
+
+export type Label = ComAtprotoLabelDefs.Label
+
+export interface LabelValGroup {
+  id: keyof LabelPreferencesModel | 'illegal' | 'unknown'
+  title: string
+  imagesOnly: boolean
+  subtitle?: string
+  warning: string
+  values: string[]
+}
+
+export interface PostLabelInfo {
+  postLabels: Label[]
+  accountLabels: Label[]
+  profileLabels: Label[]
+  isMuted: boolean
+}
+
+export interface ProfileLabelInfo {
+  accountLabels: Label[]
+  profileLabels: Label[]
+  isMuted: boolean
+}
+
+export enum ModerationBehaviorCode {
+  Show,
+  Hide,
+  Warn,
+  WarnContent,
+  WarnImages,
+}
+
+export interface ModerationBehavior {
+  behavior: ModerationBehaviorCode
+  noOverride?: boolean
+  reason?: string
+}
+
+export interface AvatarModeration {
+  warn: boolean
+  blur: boolean
+}
+
+export interface PostModeration {
+  avatar: AvatarModeration
+  list: ModerationBehavior
+  thread: ModerationBehavior
+  view: ModerationBehavior
+}
+
+export interface ProfileModeration {
+  avatar: AvatarModeration
+  list: ModerationBehavior
+  view: ModerationBehavior
+}