Skip to content

Conversation

earlduque
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@chelming chelming left a comment

Choose a reason for hiding this comment

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

you could do it all in one line with

message_body = message_body.replace(/^\s*/gm,'').match(/^(real_name|tz_label|email):.*$/gm).join('\n');

if any other fields get added we wouldn't have to worry about leading spaces then 🤷

or just change the replace line in yours to .replace(/^\s*/gm,'')

@@ -37,6 +37,7 @@ if (current.channel == "GD51HTR46" || current.channel == "G9LAJG7G8" || current.
}

message_body = message_body.match(/^(real_name|tz_label| {2}email):.*$/gm).join('\n');
message_body = message_body.replace(/^\s{2}(email)/gm, '$1');
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could trim before joining in case we ever have other indented lines.

@earlduque earlduque merged commit 07bb923 into ServiceNowDevProgram:main Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants