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 = (() => {
|
const isValid = (() => {
|
||||||
if (type === 'link') {
|
if (type === 'link') {
|
||||||
if (!link || linkError) {
|
if (!link || linkError) {
|
||||||
if (link && linkError && linkErrorBypass) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (link && linkErrorBypass) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (validatedLink || link === bookmark?.link_url) {
|
if (validatedLink || link === bookmark?.link_url) {
|
||||||
return true;
|
return true;
|
||||||
@@ -360,6 +360,14 @@ function ChannelBookmarkCreateModal({
|
|||||||
linkStatusIndicator = checkedIcon;
|
linkStatusIndicator = checkedIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let linkMessage = formatMessage(msg.linkInfoMessage);
|
||||||
|
if (linkErrorBypass) {
|
||||||
|
const url = validHttpUrl(link);
|
||||||
|
if (url) {
|
||||||
|
linkMessage = formatMessage(msg.invalidLinkMessage, {link: url.toString()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericModal
|
<GenericModal
|
||||||
enforceFocus={!showEmojiPicker}
|
enforceFocus={!showEmojiPicker}
|
||||||
@@ -391,7 +399,7 @@ function ChannelBookmarkCreateModal({
|
|||||||
data-testid='linkInput'
|
data-testid='linkInput'
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
addon={linkStatusIndicator}
|
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) => {
|
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(),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='channel_bookmarks.create.error.invalid_url.continue_anyway'
|
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'},
|
editHeading: {id: 'channel_bookmarks.create.edit.title', defaultMessage: 'Edit bookmark'},
|
||||||
linkPlaceholder: {id: 'channel_bookmarks.create.link_placeholder', defaultMessage: 'Link'},
|
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'},
|
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'},
|
addBookmarkText: {id: 'channel_bookmarks.create.confirm_add.button', defaultMessage: 'Add bookmark'},
|
||||||
saveText: {id: 'channel_bookmarks.create.confirm_save.button', defaultMessage: 'Save bookmark'},
|
saveText: {id: 'channel_bookmarks.create.confirm_save.button', defaultMessage: 'Save bookmark'},
|
||||||
fileInputEdit: {id: 'channel_bookmarks.create.file_input.edit', defaultMessage: 'Edit'},
|
fileInputEdit: {id: 'channel_bookmarks.create.file_input.edit', defaultMessage: 'Edit'},
|
||||||
@@ -679,7 +676,7 @@ export const useBookmarkLinkValidation = (link: string, onValidated: (validatedL
|
|||||||
setError(continuableLinkErr(url, () => {
|
setError(continuableLinkErr(url, () => {
|
||||||
onValidated(link, true);
|
onValidated(link, true);
|
||||||
setSuppressed(true);
|
setSuppressed(true);
|
||||||
setError(continuableLinkErr(url));
|
setError(undefined);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -3137,7 +3137,7 @@
|
|||||||
"channel_bookmarks.create.error.generic_save": "There was an error trying to save the bookmark.",
|
"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": "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.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.edit": "Edit",
|
||||||
"channel_bookmarks.create.file_input.label": "Attachment",
|
"channel_bookmarks.create.file_input.label": "Attachment",
|
||||||
"channel_bookmarks.create.link_info": "Add a link to any post, file, or any external link",
|
"channel_bookmarks.create.link_info": "Add a link to any post, file, or any external link",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user