提交 cae5d741 编写于 作者: S Seiji Sogabe

[FIXED JENKINS-12279] Link to user profile from console output should go to the user ID, not the

user name
上级 2ac1df4b
......@@ -61,6 +61,9 @@ Upcoming changes</a>
<li class='rfe'>
Reduced overhead of maven jobs.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11883">issue 11883</a>)
<li class=bug>
Link to user profile from console output should go to the user ID, not the user name
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-12279">issue 12279</a>)
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -36,7 +36,7 @@ import org.kohsuke.stapler.export.ExportedBean;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
/**
* Cause object base class. This class hierarchy is used to keep track of why
* Cause object base class. This class hierarchy is used to keep track of why
* a given build was started. This object encapsulates the UI rendering of the cause,
* as well as providing more useful information in respective subypes.
*
......@@ -89,13 +89,13 @@ public abstract class Cause {
public LegacyCodeCause() {
stackTrace = new Exception().getStackTrace();
}
@Override
public String getShortDescription() {
return Messages.Cause_LegacyCodeCause_ShortDescription();
}
}
/**
* A build is triggered by the completion of another build (AKA upstream build.)
*/
......@@ -116,7 +116,7 @@ public abstract class Cause {
public UpstreamCause(AbstractBuild<?,?> up) {
this((Run<?,?>)up);
}
public UpstreamCause(Run<?, ?> up) {
upstreamBuild = up.getNumber();
upstreamProject = up.getParent().getFullName();
......@@ -152,7 +152,7 @@ public abstract class Cause {
public String getUpstreamUrl() {
return upstreamUrl;
}
@Override
public String getShortDescription() {
return Messages.Cause_UpstreamCause_ShortDescription(upstreamProject, upstreamBuild);
......@@ -182,7 +182,7 @@ public abstract class Cause {
/**
* A build is started by an user action.
*
*
* @deprecated 1.428
* use {@link UserIdCause}
*/
......@@ -217,13 +217,13 @@ public abstract class Cause {
/**
* A build is started by an user action.
*
*
* @since 1.427
*/
public static class UserIdCause extends Cause {
private String userId;
public UserIdCause() {
User user = User.current();
this.userId = (user == null) ? null : user.getId();
......@@ -233,13 +233,13 @@ public abstract class Cause {
public String getUserId() {
return userId;
}
@Exported(visibility = 3)
public String getUserName() {
String userName = "anonymous";
if (userId != null) {
User user = User.get(userId, false);
if (user != null)
if (user != null)
userName = user.getDisplayName();
}
return userName;
......@@ -249,13 +249,13 @@ public abstract class Cause {
public String getShortDescription() {
return Messages.Cause_UserIdCause_ShortDescription(getUserName());
}
@Override
public void print(TaskListener listener) {
listener.getLogger().println(Messages.Cause_UserIdCause_ShortDescription(
HyperlinkNote.encodeTo("/user/"+getUserName(), getUserName())));
HyperlinkNote.encodeTo("/user/"+getUserId(), getUserName())));
}
@Override
public boolean equals(Object o) {
return o instanceof UserIdCause && Arrays.equals(new Object[]{userId},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册