aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hipchat-stfu.pl8
-rwxr-xr-xtest.pl1
2 files changed, 9 insertions, 0 deletions
diff --git a/hipchat-stfu.pl b/hipchat-stfu.pl
index 413380a..95bd0d4 100644
--- a/hipchat-stfu.pl
+++ b/hipchat-stfu.pl
@@ -15,6 +15,9 @@ $VERSION = '1.00';
sub prettify_hipchat {
my ($input) = @_;
+ # Grab browse link
+ my ($link) = $input =~ /"([^"]+\/browse\/[^"]+)"/;
+
# Remove HTML tags
$input =~ s/<.+?>//g;
@@ -24,6 +27,11 @@ sub prettify_hipchat {
# Trim whitespace between words
$input =~ s/(\s| ){2,}/ /g;
+ # Construct start message
+ if ($link) {
+ $input =~ s/ Created by/\n$link\nCreated by/g;
+ }
+
return $input;
};
diff --git a/test.pl b/test.pl
index f1c306c..5a0ace1 100755
--- a/test.pl
+++ b/test.pl
@@ -10,6 +10,7 @@ SC-1000 : Some kind of issue text that is kind of long and describes the problem
https://somecompany.atlassian.net/browse/SC-2169
Created by Person Name
END_MESSAGE
+chomp($title_message);
is(prettify_hipchat(' <img src="https://somecompany.atlassian.net/images/16jira.png" height="16" width="16" /> <a href="https://somecompany.atlassian.net/browse/SC-2169"><b>SC-1000 : Some kind of issue text that is kind of long and describes the problem that we saw during testing.</b></a> Created by <a href="https://somecompany.atlassian.net/secure/ViewProfile.jspa?name=PersonN">Person Name</a><br />'),
$title_message,