Skip to content

Commit

Permalink
Add commit message to subject.
Browse files Browse the repository at this point in the history
Also remove "comment on" from subject to make more room.
  • Loading branch information
ejball committed May 9, 2012
1 parent 7ad3bdb commit 4855937
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/GitHubFeeds/Controllers/CommentsController.cs
Expand Up @@ -255,7 +255,7 @@ private SyndicationItem CreateCommentItem(ListParameters p, GitHubComment commen
{
GitHubCommentModel model = CreateCommentModel(p.Version, comment);
string title = p.Version == 1 ? "{0} commented on {1}/{2}".FormatWith(model.Commenter, p.User, p.Repo) :
"Comment on {0}’s commit".FormatWith(model.Author);
"{0}’s commit: {1}".FormatWith(model.Author, RenderCommitForSubject(model));

return new SyndicationItem(title,
new TextSyndicationContent(CreateCommentHtml(p.Version, model), TextSyndicationContentKind.Html),
Expand All @@ -266,6 +266,15 @@ private SyndicationItem CreateCommentItem(ListParameters p, GitHubComment commen
};
}

private static string RenderCommitForSubject(GitHubCommentModel model)
{
string message = Regex.Replace(model.CommitMessage, @"\s+", " ").Trim();
const int maxLength = 100;
if (message.Length > maxLength)
message = message.Substring(0, maxLength) + "\u2026";
return message;
}

private GitHubCommentModel CreateCommentModel(int version, GitHubComment comment)
{
// create URL for the commit from the comment URL
Expand Down

0 comments on commit 4855937

Please sign in to comment.