提交 97b02cd3 编写于 作者: A Andrew Erickson 提交者: Kohsuke Kawaguchi

getOfflineCauseReason handles localization

also handles usernames that are emails
上级 7f2e83cb
...@@ -264,12 +264,15 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces ...@@ -264,12 +264,15 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
if (offlineCause == null) { if (offlineCause == null) {
return ""; return "";
} }
// remove header string from offline cause when a comment was set // fetch the localized string for "Disconnected By"
String newString = offlineCause.toString().replaceAll( String gsub_base = hudson.slaves.Messages.SlaveComputer_DisconnectedBy("","");
"^Disconnected by [\\w]* \\: ",""); // regex to remove commented reason base string
// remove header string from offline cause when no comment was set String gsub1 = "^" + gsub_base + "[\\w\\W]* \\: ";
return newString.replaceAll( // regex to remove non-commented reason base string
"^Disconnected by [\\w]*",""); String gsub2 = "^" + gsub_base + "[\\w\\W]*";
String newString = offlineCause.toString().replaceAll(gsub1, "");
return newString.replaceAll(gsub2, "");
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册