chore: remove shorcut lower name

This commit is contained in:
Steven 2023-09-05 20:55:02 +08:00
parent 4f0a8cdc0a
commit 4a50248fbc
3 changed files with 4 additions and 8 deletions

View File

@ -92,7 +92,7 @@ func (s *APIV1Service) registerShortcutRoutes(g *echo.Group) {
shortcut := &storepb.Shortcut{ shortcut := &storepb.Shortcut{
CreatorId: userID, CreatorId: userID,
Name: strings.ToLower(create.Name), Name: create.Name,
Link: create.Link, Link: create.Link,
Title: create.Title, Title: create.Title,
Description: create.Description, Description: create.Description,
@ -157,10 +157,6 @@ func (s *APIV1Service) registerShortcutRoutes(g *echo.Group) {
if err := json.NewDecoder(c.Request().Body).Decode(patch); err != nil { if err := json.NewDecoder(c.Request().Body).Decode(patch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("failed to decode patch shortcut request, err: %s", err)).SetInternal(err) return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("failed to decode patch shortcut request, err: %s", err)).SetInternal(err)
} }
if patch.Name != nil {
name := strings.ToLower(*patch.Name)
patch.Name = &name
}
shortcutUpdate := &store.UpdateShortcut{ shortcutUpdate := &store.UpdateShortcut{
ID: shortcutID, ID: shortcutID,

View File

@ -8,7 +8,7 @@ import Icon from "./Icon";
const generateTempName = (length = 6) => { const generateTempName = (length = 6) => {
let result = ""; let result = "";
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
const charactersLength = characters.length; const charactersLength = characters.length;
let counter = 0; let counter = 0;
while (counter < length) { while (counter < length) {
@ -53,7 +53,7 @@ const CreateShortcutsButton = () => {
const tab = tabs[0]; const tab = tabs[0];
setState((state) => ({ setState((state) => ({
...state, ...state,
name: generateTempName().toLowerCase() + "-temp", name: generateTempName() + "-temp",
title: tab.title || "", title: tab.title || "",
link: tab.url || "", link: tab.url || "",
})); }));

View File

@ -74,7 +74,7 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
const handleNameInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleNameInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setPartialState({ setPartialState({
shortcutCreate: Object.assign(state.shortcutCreate, { shortcutCreate: Object.assign(state.shortcutCreate, {
name: e.target.value.replace(/\s+/g, "-").toLowerCase(), name: e.target.value.replace(/\s+/g, "-"),
}), }),
}); });
}; };