summaryrefslogtreecommitdiff
path: root/internal/validate/formvalidation.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2023-07-29 03:49:14 -0700
committerLibravatar GitHub <noreply@github.com>2023-07-29 12:49:14 +0200
commitb874e9251e00961f295e4c409e1b34da89fab4ed (patch)
treecb528816250f322707a90c0954c963886ea96c19 /internal/validate/formvalidation.go
parent[chore] Update activity dependency (#2031) (diff)
downloadgotosocial-b874e9251e00961f295e4c409e1b34da89fab4ed.tar.xz
[feature] Implement markers API (#1989)
* Implement markers API Fixes #1856 * Correct import grouping in markers files * Regenerate Swagger for markers API * Shorten names for readability * Cache markers for 6 hours * Update DB ref * Update envparsing.sh
Diffstat (limited to 'internal/validate/formvalidation.go')
-rw-r--r--internal/validate/formvalidation.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/validate/formvalidation.go b/internal/validate/formvalidation.go
index c109c26d8..76ce6a8de 100644
--- a/internal/validate/formvalidation.go
+++ b/internal/validate/formvalidation.go
@@ -289,3 +289,15 @@ func ListRepliesPolicy(repliesPolicy gtsmodel.RepliesPolicy) error {
return fmt.Errorf("list replies_policy must be either empty or one of 'followed', 'list', 'none'")
}
}
+
+// MarkerName checks that the desired marker timeline name is valid.
+func MarkerName(name string) error {
+ if name == "" {
+ return fmt.Errorf("empty string for marker timeline name not allowed")
+ }
+ switch apimodel.MarkerName(name) {
+ case apimodel.MarkerNameHome, apimodel.MarkerNameNotifications:
+ return nil
+ }
+ return fmt.Errorf("marker timeline name '%s' was not recognized, valid options are '%s', '%s'", name, apimodel.MarkerNameHome, apimodel.MarkerNameNotifications)
+}