From 81315d490bcd5a6dd1bbfcbe45f93d88de094fec Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:10:51 +0530 Subject: [PATCH 1/2] removed description restrictions from org --- handlers/organizations.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/handlers/organizations.go b/handlers/organizations.go index 7c022c83e..c779a9fc0 100644 --- a/handlers/organizations.go +++ b/handlers/organizations.go @@ -51,13 +51,6 @@ func (oh *organizationHandler) CreateOrEditOrganization(w http.ResponseWriter, r return } - if len(org.Description) == 0 || len(org.Description) > 120 { - fmt.Printf("invalid organization name %s\n", org.Description) - w.WriteHeader(http.StatusBadRequest) - json.NewEncoder(w).Encode("Error: organization description must be present and should not exceed 120 character") - return - } - if pubKeyFromAuth != org.OwnerPubKey { hasRole := db.UserHasAccess(pubKeyFromAuth, org.Uuid, db.EditOrg) if !hasRole { From 5cdabe70d67162634abdc4ace12e2de75cdec974 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:23:09 +0530 Subject: [PATCH 2/2] fix --- handlers/organization_test.go | 1 - handlers/organizations.go | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/handlers/organization_test.go b/handlers/organization_test.go index 2e5973aee..154cb2c0e 100644 --- a/handlers/organization_test.go +++ b/handlers/organization_test.go @@ -111,7 +111,6 @@ func TestUnitCreateOrEditOrganization(t *testing.T) { description string wantStatus int }{ - {"empty description", "", http.StatusBadRequest}, {"long description", strings.Repeat("a", 121), http.StatusBadRequest}, } diff --git a/handlers/organizations.go b/handlers/organizations.go index c779a9fc0..a9faf1ee7 100644 --- a/handlers/organizations.go +++ b/handlers/organizations.go @@ -51,6 +51,13 @@ func (oh *organizationHandler) CreateOrEditOrganization(w http.ResponseWriter, r return } + if len(org.Description) > 120 { + fmt.Printf("invalid organization name %s\n", org.Description) + w.WriteHeader(http.StatusBadRequest) + json.NewEncoder(w).Encode("Error: organization description should not exceed 120 character") + return + } + if pubKeyFromAuth != org.OwnerPubKey { hasRole := db.UserHasAccess(pubKeyFromAuth, org.Uuid, db.EditOrg) if !hasRole {