Skip to content

change to just a space if highlight is empty#501

Open
hannah38 wants to merge 2 commits into
mainfrom
DTSPO-22071-highlights-space
Open

change to just a space if highlight is empty#501
hannah38 wants to merge 2 commits into
mainfrom
DTSPO-22071-highlights-space

Conversation

@hannah38

@hannah38 hannah38 commented Nov 5, 2024

Copy link
Copy Markdown
Contributor

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

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)
  • Does this PR introduce a breaking change

@hannah38 hannah38 requested a review from a team as a code owner November 5, 2024 16:45
@hannah38 hannah38 requested review from JoshuaGlassKainos, reespozzi and ssian2 and removed request for a team November 5, 2024 16:45
@hmcts-platform-operations

Copy link
Copy Markdown

Plan Result (cftptl - Job)

No changes. Your infrastructure matches the configuration.

Comment thread src/messages/util.js
convertHighlightToSlackMarkup(item.captions[0].highlights) ||
"Generated highlight not available at this time"
);
return convertHighlightToSlackMarkup(item.captions[0].highlights) || " ";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 || " ";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants