Don't print the 'old' description. Format {quote}s
1 files changed, 18 insertions(+), 12 deletions(-)

M googlechat.groovy
M googlechat.groovy +18 -12
@@ 159,6 159,19 @@ class SimpleChatMessage implements ChatM
 		} else { null }
 	}
 
+	String reformat(String text) {
+		text?.
+			replaceAll(~"\\{quote\\}\\r?", '```')?.
+			replaceAll(~"\\{noformat\\}\\r?", '```')?.
+			replaceAll(~"\\{code(?::[a-z]+)?\\}\\r?", '```')?.
+			replaceAll(~"\\{color[#:0-9a-f]*\\}", "")?.
+			replaceAll(~"h[1-6]\\. (.*)", '*$1*')?.
+			replaceAll(~'[\n\r]{4}', "\n")?.
+			replaceAll(~'\\[([^|]+)\\|(http[^]]+)\\]', '<$2|$1>')?.
+			replaceAll(~'\\{\\{(.*?)\\}\\}', '`$1`')?.
+			replaceAll(~'[A-Z]+-[0-9]+', "<${baseUrl}/browse/"+'$0|$0>');
+	}
+
 	String changeLog() {
 		if (event?.changeLog) {
 			// "changeitems: ${event.changeLog.getRelated('ChildChangeItem').getClass()}";

          
@@ 171,6 184,8 @@ class SimpleChatMessage implements ChatM
 				if (field == "WorklogId") { 
 					// worklog ID is weird. Only the 'old' value is set
 					keyValue(field, oldval);
+				} else if (field == "description") { 
+					keyValue(field, reformat(oldval)); // Don't print the old description, it's too confusing
 				} else {
 					keyValue(field, newval + (oldval ? " (was: ${oldval})" : ""));
 				}

          
@@ 178,21 193,12 @@ class SimpleChatMessage implements ChatM
 			.join("\n")
 		}
 	}
+
 	String comment() {
 		if (event.comment) {
-			def formattedComment = event.comment?.body?.
-				replaceAll(~"\\{noformat\\}\\r?", '```')?.
-				replaceAll(~"\\{code(?::[a-z]+)?\\}\\r?", '```')?.
-				replaceAll(~"\\{color[#:0-9a-f]*\\}", "")?.
-				replaceAll(~"h[1-6]\\. (.*)", '*$1*')?.
-				replaceAll(~'[\n\r]{4}', "\n")?.
-				replaceAll(~'\\[([^|]+)\\|(http[^]]+)\\]', '<$2|$1>')?.
-				replaceAll(~'\\{\\{(.*?)\\}\\}', '`$1`')?.
-				replaceAll(~'[A-Z]+-[0-9]+', "<${baseUrl}/browse/"+'$0|$0>');
-			//log "Pre-formatting: ${event.comment?.body}";
-			//log "Post-formatting: ${formattedComment}";
+			def formattedComment = reformat(event.comment?.body);
 			if (event?.changeLog) { 
-				return '`Comment`: ' + formattedComment;
+				return '`Comment`: ' + formattedContent;
 			} else 
 				return formattedComment;
 		}