kim is a reply guy (#208)

* bun debug

* bun trace logging hooks

* more tests

* fix up some stuffffff

* drop the frontend cache until a proper fix is made

* go fmt
This commit is contained in:
tobi
2021-09-11 13:19:06 +02:00
committed by GitHub
parent 64bd689e55
commit 9dc2255a8f
20 changed files with 537 additions and 163 deletions

View File

@ -23,6 +23,7 @@ import (
"fmt"
"net/mail"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/regexes"
pwv "github.com/wagslane/go-password-validator"
"golang.org/x/text/language"
@ -126,8 +127,14 @@ func Note(note string) error {
// Privacy checks that the desired privacy setting is valid
func Privacy(privacy string) error {
// TODO: add some validation logic here -- length, characters, etc
return nil
if privacy == "" {
return fmt.Errorf("empty string for privacy not allowed")
}
switch apimodel.Visibility(privacy) {
case apimodel.VisibilityDirect, apimodel.VisibilityMutualsOnly, apimodel.VisibilityPrivate, apimodel.VisibilityPublic, apimodel.VisibilityUnlisted:
return nil
}
return fmt.Errorf("privacy %s was not recognized", privacy)
}
// EmojiShortcode just runs the given shortcode through the regular expression