提交 cba29b60 编写于 作者: S sogabe

[FIXED HUDSON-7384] RSS of each user's "last builds only" are not found.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@34510 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5413d125
......@@ -1786,7 +1786,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
private static class DefaultFeedAdapter implements FeedAdapter<Run> {
public String getEntryTitle(Run entry) {
return entry+" ("+entry.getResult()+")";
return entry+" ("+entry.getBuildStatusSummary().message+")";
}
public String getEntryUrl(Run entry) {
......
......@@ -31,7 +31,6 @@ import hudson.Functions;
import hudson.Util;
import hudson.XmlFile;
import hudson.BulkChange;
import hudson.tasks.Mailer;
import hudson.model.Descriptor.FormException;
import hudson.model.listeners.SaveableListener;
import hudson.security.ACL;
......@@ -55,7 +54,6 @@ import java.io.File;
import java.io.IOException;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
......@@ -482,19 +480,34 @@ public class User extends AbstractModelObject implements AccessControlled, Savea
rsp.sendRedirect2("../..");
}
public void doRssAll( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
rss(req, rsp, " all builds", RunList.fromRuns(getBuilds()));
public void doRssAll(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
rss(req, rsp, " all builds", RunList.fromRuns(getBuilds()), Run.FEED_ADAPTER);
}
public void doRssFailed( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
rss(req, rsp, " regression builds", RunList.fromRuns(getBuilds()).regressionOnly());
public void doRssFailed(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
rss(req, rsp, " regression builds", RunList.fromRuns(getBuilds()).regressionOnly(), Run.FEED_ADAPTER);
}
private void rss(StaplerRequest req, StaplerResponse rsp, String suffix, RunList runs) throws IOException, ServletException {
RSS.forwardToRss(getDisplayName()+ suffix, getUrl(),
runs.newBuilds(), FEED_ADAPTER, req, rsp );
public void doRssLatest(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
final List<Run> lastBuilds = new ArrayList<Run>();
for (final TopLevelItem item : Hudson.getInstance().getItems()) {
if (!(item instanceof Job)) continue;
for (Run r = ((Job) item).getLastBuild(); r != null; r = r.getPreviousBuild()) {
if (!(r instanceof AbstractBuild)) continue;
final AbstractBuild b = (AbstractBuild) r;
if (b.hasParticipant(this)) {
lastBuilds.add(b);
break;
}
}
}
rss(req, rsp, " latest build", RunList.fromRuns(lastBuilds), Run.FEED_ADAPTER_LATEST);
}
private void rss(StaplerRequest req, StaplerResponse rsp, String suffix, RunList runs, FeedAdapter adapter)
throws IOException, ServletException {
RSS.forwardToRss(getDisplayName()+ suffix, getUrl(), runs.newBuilds(), adapter, req, rsp);
}
/**
* Keyed by {@link User#id}. This map is used to ensure
......@@ -513,37 +526,6 @@ public class User extends AbstractModelObject implements AccessControlled, Savea
XSTREAM.alias("user",User.class);
}
/**
* {@link FeedAdapter} to produce build status summary in the feed.
*/
public static final FeedAdapter<Run> FEED_ADAPTER = new FeedAdapter<Run>() {
public String getEntryTitle(Run entry) {
return entry+" : "+entry.getBuildStatusSummary().message;
}
public String getEntryUrl(Run entry) {
return entry.getUrl();
}
public String getEntryID(Run entry) {
return "tag:"+entry.getParent().getName()+':'+entry.getId();
}
public String getEntryDescription(Run entry) {
// TODO: provide useful details
return null;
}
public Calendar getEntryTimestamp(Run entry) {
return entry.getTimestamp();
}
public String getEntryAuthor(Run entry) {
return Mailer.descriptor().getAdminAddress();
}
};
public ACL getACL() {
final ACL base = Hudson.getInstance().getAuthorizationStrategy().getACL(this);
// always allow a non-anonymous user full control of himself.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册