0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-09 21:41:23 -05:00

🐛 Fix allow team name to be all blank

This commit is contained in:
Eva 2023-07-03 12:51:34 +02:00 committed by Alejandro Alonso
parent 4d4e9703cc
commit 02466d603c
4 changed files with 27 additions and 2 deletions

View file

@ -26,7 +26,7 @@
- Fix asset color item was created from the selected layer [Taiga #5180](https://tree.taiga.io/project/penpot/issue/5180)
- Fix unpublish more than one library at the same time [Taiga #5532](https://tree.taiga.io/project/penpot/issue/5532)
- Fix drag projects on dahsboard [Taiga #5531](https://tree.taiga.io/project/penpot/issue/5531)
- Fix allow team name to be all blank [Taiga #5527](https://tree.taiga.io/project/penpot/issue/5527)
### :arrow_up: Deps updates

View file

@ -17,12 +17,20 @@
[app.util.router :as rt]
[beicon.core :as rx]
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[rumext.v2 :as mf]))
(s/def ::name ::us/not-empty-string)
(s/def ::team-form
(s/keys :req-un [::name]))
(defn- validate-name
[errors data]
(let [name (-> data :name str/trim)]
(cond-> errors
(str/empty? name)
(assoc :name {:message (tr "dashboard.team-name.not-empty-name")}))))
(defn- on-create-success
[_form response]
(let [msg "Team created successfully"]
@ -66,10 +74,11 @@
(on-create-submit form))))
(mf/defc team-form-modal {::mf/register modal/components
::mf/register-as :team-form}
::mf/register-as :team-form}
[{:keys [team] :as props}]
(let [initial (mf/use-memo (fn [] (or team {})))
form (fm/use-form :spec ::team-form
:validators [validate-name]
:initial initial)]
[:div.modal-overlay
[:div.modal-container.team-form-modal

View file

@ -113,6 +113,10 @@ msgstr "Password"
msgid "auth.password-length-hint"
msgstr "At least 8 characters"
#: src/app/main/ui/auth/register.cljs
msgid "auth.password-not-empty"
msgstr "Password must contain some character other than space."
msgid "auth.privacy-policy"
msgstr "Privacy policy"
@ -371,6 +375,10 @@ msgstr "180 days"
msgid "dashboard.access-tokens.errors-required-name"
msgstr "The name is required"
#: src/app/main/ui/settings/team-form.cljs
msgid "dashboard.team-name.not-empty-name"
msgstr "The name must contain some character other than space."
#: src/app/main/ui/settings/access-tokens.cljs
msgid "dashboard.access-tokens.token-will-expire"
msgstr "The token will expire on %s"

View file

@ -118,6 +118,10 @@ msgstr "Contraseña"
msgid "auth.password-length-hint"
msgstr "8 caracteres como mínimo"
#: src/app/main/ui/auth/register.cljs
msgid "auth.password-not-empty"
msgstr "La contraseña debe contener algún caracter diferente de espacio"
msgid "auth.privacy-policy"
msgstr "Política de privacidad"
@ -378,6 +382,10 @@ msgstr "180 días"
msgid "dashboard.access-tokens.errors-required-name"
msgstr "El nombre es obligatorio"
#: src/app/main/ui/settings/team-form.cljs
msgid "dashboard.team-name.not-empty-name"
msgstr "El nombre debe contener algún carácter diferente de espacio"
#: src/app/main/ui/settings/access-tokens.cljs
msgid "dashboard.access-tokens.token-will-expire"
msgstr "El token expirará el %s"