From b0d9047894644a97d171dd7331c43d0c4c69e872 Mon Sep 17 00:00:00 2001 From: AmbrishRamachandiran Date: Thu, 27 Jul 2023 12:02:13 +0530 Subject: [PATCH] Limit the use of the same shortcut name when adding a shortcut Signed-off-by: AmbrishRamachandiran --- plugins/shortcuts/src/AddShortcut.tsx | 4 +--- plugins/shortcuts/src/EditShortcut.tsx | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/shortcuts/src/AddShortcut.tsx b/plugins/shortcuts/src/AddShortcut.tsx index e518a89934..d1a17f267f 100644 --- a/plugins/shortcuts/src/AddShortcut.tsx +++ b/plugins/shortcuts/src/AddShortcut.tsx @@ -64,9 +64,7 @@ export const AddShortcut = ({ const shortcutData = api.get(); const handleSave: SubmitHandler = async ({ url, title }) => { - if (!api.get().some(shortcutTitle => shortcutTitle.title === title)) { - analytics.captureEvent('click', `Clicked 'Save' in AddShortcut`); - } + analytics.captureEvent('click', `Clicked 'Save' in AddShortcut`); const shortcut: Omit = { url, title }; try { diff --git a/plugins/shortcuts/src/EditShortcut.tsx b/plugins/shortcuts/src/EditShortcut.tsx index 5f1125e37a..288b35d9f0 100644 --- a/plugins/shortcuts/src/EditShortcut.tsx +++ b/plugins/shortcuts/src/EditShortcut.tsx @@ -63,9 +63,7 @@ export const EditShortcut = ({ const shortcutData = api.get(); const handleSave: SubmitHandler = async ({ url, title }) => { - if (!api.get().some(shortcutTitle => shortcutTitle.title === title)) { - analytics.captureEvent('click', `Clicked 'Save' in Edit Shortcut`); - } + analytics.captureEvent('click', `Clicked 'Save' in Edit Shortcut`); const newShortcut: Shortcut = { ...shortcut, url,