From 4f1208ea980618cbd4c0ac5b3089af911a3e96c1 Mon Sep 17 00:00:00 2001 From: Boris Bera Date: Fri, 3 Jul 2015 23:25:13 -0400 Subject: [PATCH 1/2] Atom feed now puts the activity message in title Originally it used to put the activity type in the message. This gave no useful information. The user had to open the news item to see what was going on. Now, the title is the activity's message rendered to html. Note that this is the same as the content of the news item. This fixes #481 --- src/main/twirl/gitbucket/core/helper/feed.scala.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/twirl/gitbucket/core/helper/feed.scala.xml b/src/main/twirl/gitbucket/core/helper/feed.scala.xml index 865cee9a1..440e1ff54 100644 --- a/src/main/twirl/gitbucket/core/helper/feed.scala.xml +++ b/src/main/twirl/gitbucket/core/helper/feed.scala.xml @@ -16,7 +16,7 @@ @datetimeRFC3339(activity.activityDate) @datetimeRFC3339(activity.activityDate) - @activity.activityType + @activityMessage(activity.message) @activity.activityUserName @url(activity.activityUserName) From 59e826b630bf739a9d9cd2b155e1a8e6b65e7fbc Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 5 Jul 2015 22:15:39 +0900 Subject: [PATCH 2/2] (refs #811)Remove html tags from title of atom feed --- src/main/scala/gitbucket/core/view/helpers.scala | 5 +++++ src/main/twirl/gitbucket/core/helper/feed.scala.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/view/helpers.scala b/src/main/scala/gitbucket/core/view/helpers.scala index a0320ce91..221b750bc 100644 --- a/src/main/scala/gitbucket/core/view/helpers.scala +++ b/src/main/scala/gitbucket/core/view/helpers.scala @@ -155,6 +155,11 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache .replaceAll("\\[commit:([^\\s]+?)/([^\\s]+?)\\@([^\\s]+?)\\]", (m: Match) => s"""${m.group(1)}/${m.group(2)}@${m.group(3).substring(0, 7)}""") ) + /** + * Remove html tags from the given Html instance. + */ + def removeHtml(html: Html): Html = Html(html.body.replaceAll("<.+?>", "")) + /** * URL encode except '/'. */ diff --git a/src/main/twirl/gitbucket/core/helper/feed.scala.xml b/src/main/twirl/gitbucket/core/helper/feed.scala.xml index 440e1ff54..eab5badb5 100644 --- a/src/main/twirl/gitbucket/core/helper/feed.scala.xml +++ b/src/main/twirl/gitbucket/core/helper/feed.scala.xml @@ -16,7 +16,7 @@ @datetimeRFC3339(activity.activityDate) @datetimeRFC3339(activity.activityDate) - @activityMessage(activity.message) + @removeHtml(activityMessage(activity.message)) @activity.activityUserName @url(activity.activityUserName)