Skip to content
Snippets Groups Projects
Commit 419b5ce7 authored by Tom Robinson's avatar Tom Robinson
Browse files

Misc humanization tweaks

parent dcefc1c7
No related branches found
No related tags found
No related merge requests found
...@@ -9997,6 +9997,7 @@ sokka ...@@ -9997,6 +9997,7 @@ sokka
modify modify
suits suits
nu nu
inbox
tempo tempo
eaters eaters
beechworth beechworth
...@@ -65240,7 +65241,6 @@ sneaked ...@@ -65240,7 +65241,6 @@ sneaked
gyeongsang gyeongsang
feldkirch feldkirch
franchising franchising
inbox
takata takata
madder madder
mbisanz mbisanz
...@@ -125529,3 +125529,9 @@ blabbing ...@@ -125529,3 +125529,9 @@ blabbing
oracular oracular
incapability incapability
pebbliest pebbliest
auth
uid
uuid
guid
authenticator
acquirer
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
[metabase.models.setting :refer [defsetting], :as setting] [metabase.models.setting :refer [defsetting], :as setting]
[metabase.util.infer-spaces :refer [infer-spaces]])) [metabase.util.infer-spaces :refer [infer-spaces]]))
(def ^:private ^:const acronyms
#{"id" "url" "ip" "uid" "uuid" "guid"})
(defn- capitalize-word [word] (defn- capitalize-word [word]
(if (= word "id") (if (contains? acronyms (s/lower-case word))
"ID" (s/upper-case word)
(s/capitalize word))) (s/capitalize word)))
(defn- name->human-readable-name:advanced (defn- name->human-readable-name:advanced
......
...@@ -15,6 +15,11 @@ ...@@ -15,6 +15,11 @@
(expect "" (name->human-readable-name:advanced "_")) (expect "" (name->human-readable-name:advanced "_"))
(expect "" (name->human-readable-name:advanced "-")) (expect "" (name->human-readable-name:advanced "-"))
(expect "ID" (name->human-readable-name:advanced "_id")) (expect "ID" (name->human-readable-name:advanced "_id"))
(expect "UID" (name->human-readable-name:advanced "uid"))
(expect "UUID" (name->human-readable-name:advanced "uuid"))
(expect "GUID" (name->human-readable-name:advanced "guid"))
(expect "IP" (name->human-readable-name:advanced "ip"))
(expect "URL" (name->human-readable-name:advanced "URL"))
(expect "Agent Invite Migration" (name->human-readable-name:advanced "_agent_invite_migration")) (expect "Agent Invite Migration" (name->human-readable-name:advanced "_agent_invite_migration"))
(expect "Agent Invite Migration" (name->human-readable-name:advanced "-agent-invite-migration")) (expect "Agent Invite Migration" (name->human-readable-name:advanced "-agent-invite-migration"))
(expect "Foo Bar" (name->human-readable-name:advanced "fooBar")) (expect "Foo Bar" (name->human-readable-name:advanced "fooBar"))
...@@ -24,6 +29,11 @@ ...@@ -24,6 +29,11 @@
(expect "Dashboard Card Subscription" (name->human-readable-name:advanced "dashboardcardsubscription")) (expect "Dashboard Card Subscription" (name->human-readable-name:advanced "dashboardcardsubscription"))
(expect "Foo ID" (name->human-readable-name:advanced "foo_id")) (expect "Foo ID" (name->human-readable-name:advanced "foo_id"))
(expect "Receiver ID" (name->human-readable-name:advanced "receiver_id")) (expect "Receiver ID" (name->human-readable-name:advanced "receiver_id"))
(expect "Inbox" (name->human-readable-name:advanced "inbox"))
(expect "Acquirer" (name->human-readable-name:advanced "acquirer"))
(expect "Auth Authenticator" (name->human-readable-name:advanced "auth_authenticator"))
(expect "Auth Provider" (name->human-readable-name:advanced "authprovider"))
(expect "User Social Auth" (name->human-readable-name:advanced "usersocialauth"))
;;; name->human-readable-name:simple ;;; name->human-readable-name:simple
...@@ -32,6 +42,11 @@ ...@@ -32,6 +42,11 @@
(expect "" (name->human-readable-name:simple "_")) (expect "" (name->human-readable-name:simple "_"))
(expect "" (name->human-readable-name:simple "-")) (expect "" (name->human-readable-name:simple "-"))
(expect "ID" (name->human-readable-name:simple "_id")) (expect "ID" (name->human-readable-name:simple "_id"))
(expect "UID" (name->human-readable-name:simple "uid"))
(expect "UUID" (name->human-readable-name:simple "uuid"))
(expect "GUID" (name->human-readable-name:simple "guid"))
(expect "IP" (name->human-readable-name:simple "ip"))
(expect "URL" (name->human-readable-name:simple "URL"))
(expect "Agent Invite Migration" (name->human-readable-name:simple "_agent_invite_migration")) (expect "Agent Invite Migration" (name->human-readable-name:simple "_agent_invite_migration"))
(expect "Agent Invite Migration" (name->human-readable-name:simple "-agent-invite-migration")) (expect "Agent Invite Migration" (name->human-readable-name:simple "-agent-invite-migration"))
(expect "Foobar" (name->human-readable-name:simple "fooBar")) (expect "Foobar" (name->human-readable-name:simple "fooBar"))
...@@ -41,6 +56,11 @@ ...@@ -41,6 +56,11 @@
(expect "Dashboardcardsubscription" (name->human-readable-name:simple "dashboardcardsubscription")) (expect "Dashboardcardsubscription" (name->human-readable-name:simple "dashboardcardsubscription"))
(expect "Foo ID" (name->human-readable-name:simple "foo_id")) (expect "Foo ID" (name->human-readable-name:simple "foo_id"))
(expect "Receiver ID" (name->human-readable-name:simple "receiver_id")) (expect "Receiver ID" (name->human-readable-name:simple "receiver_id"))
(expect "Inbox" (name->human-readable-name:simple "inbox"))
(expect "Acquirer" (name->human-readable-name:simple "acquirer"))
(expect "Auth Authenticator" (name->human-readable-name:simple "auth_authenticator"))
(expect "Authprovider" (name->human-readable-name:simple "authprovider"))
(expect "Usersocialauth" (name->human-readable-name:simple "usersocialauth"))
;;; Re-humanization ;;; Re-humanization
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment