From e493cfdfa99ba780f1cd61c5575e169c8eb46845 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 9 Nov 2011 17:01:59 -0500 Subject: [PATCH] Restored html content to feeds. Include regex substitutions in content. --- docs/00_index.mkd | 1 + docs/04_releases.mkd | 1 + src/com/gitblit/SyndicationServlet.java | 7 ++++--- src/com/gitblit/client/FeedsPanel.java | 2 +- src/com/gitblit/client/GitblitClient.java | 2 +- src/com/gitblit/client/SearchDialog.java | 2 +- src/com/gitblit/utils/SyndicationUtils.java | 16 +++++++++++----- 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/00_index.mkd b/docs/00_index.mkd index 5139f041..f8c7fd4d 100644 --- a/docs/00_index.mkd +++ b/docs/00_index.mkd @@ -47,6 +47,7 @@ Gitblit requires a Java 6 Runtime Environment (JRE) or a Java 6 Development Kit - added: setting to control Gitblit GO context path for proxy setups **New:** *server.contextPath = /* - added: *combined-md5* password storage option which stores the hash of username+password as the password +- added: RSS feeds now include regex substitutions on commit messages for bug trackers, etc - fixed: federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard. **This breaks 0.6.0 federation clients/servers.** - fixed: collision on rename for repositories and users diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index a2161d28..0b6537b3 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -20,6 +20,7 @@ - added: setting to control Gitblit GO context path for proxy setups **New:** *server.contextPath = /* - added: *combined-md5* password storage option which stores the hash of username+password as the password +- added: RSS feeds now include regex substitutions on commit messages for bug trackers, etc - fixed: federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard. **This breaks 0.6.0 federation clients/servers.** - fixed: collision on rename for repositories and users diff --git a/src/com/gitblit/SyndicationServlet.java b/src/com/gitblit/SyndicationServlet.java index 66415d10..1de3d790 100644 --- a/src/com/gitblit/SyndicationServlet.java +++ b/src/com/gitblit/SyndicationServlet.java @@ -28,9 +28,9 @@ import org.eclipse.jgit.revwalk.RevCommit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.gitblit.models.FeedEntryModel; import com.gitblit.models.RefModel; import com.gitblit.models.RepositoryModel; -import com.gitblit.models.FeedEntryModel; import com.gitblit.utils.HttpUtils; import com.gitblit.utils.JGitUtils; import com.gitblit.utils.StringUtils; @@ -189,8 +189,9 @@ public class SyndicationServlet extends HttpServlet { entry.link = MessageFormat.format(urlPattern, gitblitUrl, StringUtils.encodeURL(model.name), commit.getName()); entry.published = commit.getCommitterIdent().getWhen(); - entry.contentType = "text/plain"; - entry.content = commit.getFullMessage(); + entry.contentType = "text/html"; + String message = GitBlit.self().processCommitMessage(model.name, commit.getFullMessage()); + entry.content = message; entry.repository = model.name; entry.branch = objectId; List refs = allRefs.get(commit.getId()); diff --git a/src/com/gitblit/client/FeedsPanel.java b/src/com/gitblit/client/FeedsPanel.java index 9f8de8c3..97f37c0d 100644 --- a/src/com/gitblit/client/FeedsPanel.java +++ b/src/com/gitblit/client/FeedsPanel.java @@ -42,8 +42,8 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.TableRowSorter; -import com.gitblit.models.FeedModel; import com.gitblit.models.FeedEntryModel; +import com.gitblit.models.FeedModel; import com.gitblit.utils.StringUtils; /** diff --git a/src/com/gitblit/client/GitblitClient.java b/src/com/gitblit/client/GitblitClient.java index c590dccc..c027537a 100644 --- a/src/com/gitblit/client/GitblitClient.java +++ b/src/com/gitblit/client/GitblitClient.java @@ -32,11 +32,11 @@ import com.gitblit.GitBlitException.UnauthorizedException; import com.gitblit.GitBlitException.UnknownRequestException; import com.gitblit.Keys; import com.gitblit.models.FederationModel; +import com.gitblit.models.FeedEntryModel; import com.gitblit.models.FeedModel; import com.gitblit.models.RepositoryModel; import com.gitblit.models.ServerSettings; import com.gitblit.models.ServerStatus; -import com.gitblit.models.FeedEntryModel; import com.gitblit.models.UserModel; import com.gitblit.utils.RpcUtils; import com.gitblit.utils.StringUtils; diff --git a/src/com/gitblit/client/SearchDialog.java b/src/com/gitblit/client/SearchDialog.java index 8c94a5bb..cf171160 100644 --- a/src/com/gitblit/client/SearchDialog.java +++ b/src/com/gitblit/client/SearchDialog.java @@ -43,8 +43,8 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import com.gitblit.Constants; -import com.gitblit.models.RepositoryModel; import com.gitblit.models.FeedEntryModel; +import com.gitblit.models.RepositoryModel; import com.gitblit.utils.StringUtils; /** diff --git a/src/com/gitblit/utils/SyndicationUtils.java b/src/com/gitblit/utils/SyndicationUtils.java index 6ba8d738..061d12a4 100644 --- a/src/com/gitblit/utils/SyndicationUtils.java +++ b/src/com/gitblit/utils/SyndicationUtils.java @@ -97,8 +97,14 @@ public class SyndicationUtils { } SyndContent content = new SyndContentImpl(); - content.setType(entryModel.contentType); - content.setValue(entryModel.content); + if (StringUtils.isEmpty(entryModel.contentType) + || entryModel.contentType.equalsIgnoreCase("text/plain")) { + content.setType("text/html"); + content.setValue(StringUtils.breakLinesForHtml(entryModel.content)); + } else { + content.setType(entryModel.contentType); + content.setValue(entryModel.content); + } entry.setDescription(content); entries.add(entry); @@ -167,9 +173,9 @@ public class SyndicationUtils { * @return a list of SyndicationModel entries * @throws {@link IOException} */ - public static List readSearchFeed(String url, String repository, - String branch, String fragment, Constants.SearchType searchType, int numberOfEntries, - int page, String username, char[] password) throws IOException { + public static List readSearchFeed(String url, String repository, String branch, + String fragment, Constants.SearchType searchType, int numberOfEntries, int page, + String username, char[] password) throws IOException { // determine parameters List parameters = new ArrayList(); parameters.add("s=" + StringUtils.encodeURL(fragment)); -- 2.39.5