change to just a space if highlight is empty#501
Open
hannah38 wants to merge 2 commits into
Open
Conversation
Plan Result (cftptl - Job) |
timja
reviewed
Nov 6, 2024
| convertHighlightToSlackMarkup(item.captions[0].highlights) || | ||
| "Generated highlight not available at this time" | ||
| ); | ||
| return convertHighlightToSlackMarkup(item.captions[0].highlights) || " "; |
Contributor
There was a problem hiding this comment.
something like this would be what I was trying to explain yesterday
Suggested change
| return convertHighlightToSlackMarkup(item.captions[0].highlights) || " "; | |
| const highlights = item.captions[0].highlights | |
| if (highlights?.length > 0) { | |
| return highlights | |
| } | |
| if (item?.captions[0]?.text?.length > 0) { | |
| return item.captions[0].text | |
| } | |
| // fallback to returning a single space if nothing else, (slack won't allow an empty block here) | |
| // TODO refactor so that the block isn't added if empty | |
| return " "; |
concisely this may work as well but i'm not 100% sure on it:
Suggested change
| return convertHighlightToSlackMarkup(item.captions[0].highlights) || " "; | |
| return convertHighlightToSlackMarkup(item.captions[0].highlights) || item.captions[0].text || " "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira link
DTSPO-22071
Change description
Tested locally
Removes the text - but has a character to keep Slack happy if Highlight is not generated
Testing done
Checklist