MM 60583 Update message after continuing (#28425)
* remove part of the error message * update text * once continuing, clear error --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5dc86d5010
Коммит
6dc44f2831
@@ -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 (
|
||||
<GenericModal
|
||||
enforceFocus={!showEmojiPicker}
|
||||
@@ -391,7 +399,7 @@ function ChannelBookmarkCreateModal({
|
||||
data-testid='linkInput'
|
||||
autoFocus={true}
|
||||
addon={linkStatusIndicator}
|
||||
customMessage={linkError ? {type: 'error', value: linkError} : {value: formatMessage(msg.linkInfoMessage)}}
|
||||
customMessage={linkError ? {type: 'error', value: linkError} : {value: linkMessage}}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
@@ -563,19 +571,7 @@ const FileInputContainer = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const continuableLinkErr = (url: URL, confirm?: () => void) => {
|
||||
if (!confirm) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id='channel_bookmarks.create.error.invalid_url.continuing_anyway'
|
||||
defaultMessage='Could not find: {url}. Please enter a valid link.'
|
||||
values={{
|
||||
url: url.toString(),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const continuableLinkErr = (url: URL, confirm: () => void) => {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id='channel_bookmarks.create.error.invalid_url.continue_anyway'
|
||||
@@ -620,6 +616,7 @@ const msg = defineMessages({
|
||||
editHeading: {id: 'channel_bookmarks.create.edit.title', defaultMessage: 'Edit bookmark'},
|
||||
linkPlaceholder: {id: 'channel_bookmarks.create.link_placeholder', defaultMessage: 'Link'},
|
||||
linkInfoMessage: {id: 'channel_bookmarks.create.link_info', defaultMessage: 'Add a link to any post, file, or any external link'},
|
||||
invalidLinkMessage: {id: 'channel_bookmarks.create.error.invalid_url.continuing_anyway', defaultMessage: 'This may not be a valid link: {link}.'},
|
||||
addBookmarkText: {id: 'channel_bookmarks.create.confirm_add.button', defaultMessage: 'Add bookmark'},
|
||||
saveText: {id: 'channel_bookmarks.create.confirm_save.button', defaultMessage: 'Save bookmark'},
|
||||
fileInputEdit: {id: 'channel_bookmarks.create.file_input.edit', defaultMessage: 'Edit'},
|
||||
@@ -679,7 +676,7 @@ export const useBookmarkLinkValidation = (link: string, onValidated: (validatedL
|
||||
setError(continuableLinkErr(url, () => {
|
||||
onValidated(link, true);
|
||||
setSuppressed(true);
|
||||
setError(continuableLinkErr(url));
|
||||
setError(undefined);
|
||||
}));
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -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 <Confirm>continue anyway</Confirm>.",
|
||||
"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",
|
||||
|
||||
Ссылка в новой задаче
Block a user