From 6dc44f28311b97627c85f52f5b052cfdf26368ac Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Wed, 16 Oct 2024 09:19:05 -0600 Subject: [PATCH] MM 60583 Update message after continuing (#28425) * remove part of the error message * update text * once continuing, clear error --------- Co-authored-by: Mattermost Build --- .../channel_bookmarks_create_modal.tsx | 33 +++++++++---------- webapp/channels/src/i18n/en.json | 2 +- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/webapp/channels/src/components/channel_bookmarks/channel_bookmarks_create_modal.tsx b/webapp/channels/src/components/channel_bookmarks/channel_bookmarks_create_modal.tsx index 2a30282294..4260e87a2f 100644 --- a/webapp/channels/src/components/channel_bookmarks/channel_bookmarks_create_modal.tsx +++ b/webapp/channels/src/components/channel_bookmarks/channel_bookmarks_create_modal.tsx @@ -271,11 +271,11 @@ function ChannelBookmarkCreateModal({ const isValid = (() => { if (type === 'link') { if (!link || linkError) { - if (link && linkError && linkErrorBypass) { - return true; - } return false; } + if (link && linkErrorBypass) { + return true; + } if (validatedLink || link === bookmark?.link_url) { return true; @@ -360,6 +360,14 @@ function ChannelBookmarkCreateModal({ linkStatusIndicator = checkedIcon; } + let linkMessage = formatMessage(msg.linkInfoMessage); + if (linkErrorBypass) { + const url = validHttpUrl(link); + if (url) { + linkMessage = formatMessage(msg.invalidLinkMessage, {link: url.toString()}); + } + } + return ( ) : ( @@ -563,19 +571,7 @@ const FileInputContainer = styled.div` } `; -const continuableLinkErr = (url: URL, confirm?: () => void) => { - if (!confirm) { - return ( - - ); - } - +const continuableLinkErr = (url: URL, confirm: () => void) => { return ( { onValidated(link, true); setSuppressed(true); - setError(continuableLinkErr(url)); + setError(undefined); })); } } finally { diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index c65a3a40cd..946ed300b3 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -3137,7 +3137,7 @@ "channel_bookmarks.create.error.generic_save": "There was an error trying to save the bookmark.", "channel_bookmarks.create.error.invalid_url": "Please enter a valid link. Could not parse: {link}.", "channel_bookmarks.create.error.invalid_url.continue_anyway": "Could not find: {url}. Please enter a valid link, or continue anyway.", - "channel_bookmarks.create.error.invalid_url.continuing_anyway": "Could not find: {url}. Please enter a valid link.", + "channel_bookmarks.create.error.invalid_url.continuing_anyway": "This may not be a valid link: {url}.", "channel_bookmarks.create.file_input.edit": "Edit", "channel_bookmarks.create.file_input.label": "Attachment", "channel_bookmarks.create.link_info": "Add a link to any post, file, or any external link",