From 4308f518c7f3eb5a462e0557fdbeacd033fcf85e Mon Sep 17 00:00:00 2001 From: SaarCohen Date: Mon, 21 Jul 2014 09:19:56 +0100 Subject: [PATCH 1/5] string html from change log --- SlackListener.cs | 2 +- app.manifest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SlackListener.cs b/SlackListener.cs index c5a49ed..27498ca 100644 --- a/SlackListener.cs +++ b/SlackListener.cs @@ -176,7 +176,7 @@ public override void AfterUpdateFull(IssueDtoEventArgs args) .Select(a => new { title = a.Field, - value = a.FullChange,//. + " -> " + a.Object2Value, + value = StripHTML(a.FullChange), _short = true }); diff --git a/app.manifest b/app.manifest index 2a2fca5..ba58307 100644 --- a/app.manifest +++ b/app.manifest @@ -7,6 +7,6 @@ 0 The Software Jedi 2014-07-07T11:31:00Z - true + false From 422636d3d2dd2f022fbbb361304f416f38146b57 Mon Sep 17 00:00:00 2001 From: SaarCohen Date: Mon, 21 Jul 2014 10:08:33 +0100 Subject: [PATCH 2/5] Make description short in slack --- SlackListener.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SlackListener.cs b/SlackListener.cs index 27498ca..cf05829 100644 --- a/SlackListener.cs +++ b/SlackListener.cs @@ -111,7 +111,7 @@ public override void AfterCreate(IssueEventArgs args) , args.User.Fullname, args.BuildIssueUrl(args.Entity), GetIssueKey(args), args.Entity.Title), "more details attached", "good", - new[] { new { title = "Description", value = StripHTML(args.Entity.Description) } }); + new[] { new { title = "Description", value = StripHTML(args.Entity.Description), _short = true } }); base.AfterCreate(args); } From fdcf998714040d4e8f323a8df299f0feb81c9cdd Mon Sep 17 00:00:00 2001 From: SaarCohen Date: Mon, 21 Jul 2014 10:19:22 +0100 Subject: [PATCH 3/5] Make comment short in slack --- SlackListener.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SlackListener.cs b/SlackListener.cs index cf05829..d28eabe 100644 --- a/SlackListener.cs +++ b/SlackListener.cs @@ -65,7 +65,7 @@ public override void AfterComment(IssueCommentEventArgs args) ,args.User.Fullname, args.BuildIssueUrl(args.Issue), args.Issue.IssueKey, args.Issue.Title), "more details attached", "good", - new[] { new { title = "Comment", value = StripHTML(args.Entity.Comment) } }); + new[] { new { title = "Comment", value = StripHTML(args.Entity.Comment), _short = true } }); base.AfterComment(args); } From f14b0e332dc701b9a673a805f7719e1c4f74bced Mon Sep 17 00:00:00 2001 From: SaarCohen Date: Tue, 22 Jul 2014 11:30:10 +0100 Subject: [PATCH 4/5] description and comment are not short --- SlackListener.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SlackListener.cs b/SlackListener.cs index d28eabe..60eeedb 100644 --- a/SlackListener.cs +++ b/SlackListener.cs @@ -10,7 +10,8 @@ using Countersoft.Gemini.Contracts; using Countersoft.Gemini.Commons.Entity; using Countersoft.Gemini.Infrastructure.Managers; -using System.Text; +using System.Text; +using Countersoft.Gemini.Commons.Permissions; namespace TSJ.Gemini.Slack { @@ -65,7 +66,7 @@ public override void AfterComment(IssueCommentEventArgs args) ,args.User.Fullname, args.BuildIssueUrl(args.Issue), args.Issue.IssueKey, args.Issue.Title), "more details attached", "good", - new[] { new { title = "Comment", value = StripHTML(args.Entity.Comment), _short = true } }); + new[] { new { title = "Comment", value = StripHTML(args.Entity.Comment), _short = false } }); base.AfterComment(args); } @@ -111,7 +112,7 @@ public override void AfterCreate(IssueEventArgs args) , args.User.Fullname, args.BuildIssueUrl(args.Entity), GetIssueKey(args), args.Entity.Title), "more details attached", "good", - new[] { new { title = "Description", value = StripHTML(args.Entity.Description), _short = true } }); + new[] { new { title = "Description", value = StripHTML(args.Entity.Description), _short = false } }); base.AfterCreate(args); } @@ -177,7 +178,7 @@ public override void AfterUpdateFull(IssueDtoEventArgs args) { title = a.Field, value = StripHTML(a.FullChange), - _short = true + _short = a.Entity.AttributeChanged != ItemAttributeVisibility.Description && a.Entity.AttributeChanged != ItemAttributeVisibility.AssociatedComments }); QuickSlack.Send(data.Value.SlackAPIEndpoint, channel, string.Format("{0} updated issue <{1}|{2} - {3}>" From 7cc6ab953ae58a129b59205cecfa14f2f359df4b Mon Sep 17 00:00:00 2001 From: SaarCohen Date: Wed, 23 Jul 2014 14:47:03 +0100 Subject: [PATCH 5/5] "show more" for comments and description --- QuickSlack.cs | 8 ++++---- SlackListener.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/QuickSlack.cs b/QuickSlack.cs index af0c243..9f12fd8 100644 --- a/QuickSlack.cs +++ b/QuickSlack.cs @@ -10,8 +10,8 @@ namespace TSJ.Gemini.Slack { public static class QuickSlack { - public static void Send(string slackApiUrl, string channel, string text, string fallback = null, string color = null, object[] fields = null){ - //this method could and should be a one-liner + public static void Send(string slackApiUrl, string channel, string text, string fallback = null, string color = null, object[] fields = null, string fieldsText = null){ + //this method could and should be a one-liner var o = new { channel = channel, @@ -22,10 +22,10 @@ public static void Send(string slackApiUrl, string channel, string text, string new { fallback = fallback, - //text = "", + text = fieldsText, //pretext = "", color = color, - fields = fields + fields = fieldsText.HasValue() ? null : fields } } : null diff --git a/SlackListener.cs b/SlackListener.cs index 60eeedb..45b85de 100644 --- a/SlackListener.cs +++ b/SlackListener.cs @@ -65,8 +65,8 @@ public override void AfterComment(IssueCommentEventArgs args) QuickSlack.Send(data.Value.SlackAPIEndpoint, channel, string.Format("{0} added a comment to <{1}|{2} - {3}>" ,args.User.Fullname, args.BuildIssueUrl(args.Issue), args.Issue.IssueKey, args.Issue.Title), "more details attached", - "good", - new[] { new { title = "Comment", value = StripHTML(args.Entity.Comment), _short = false } }); + "good", + new[] { new { title = "Comment", value = StripHTML(args.Entity.Comment), _short = false } }, StripHTML(args.Entity.Comment)); base.AfterComment(args); } @@ -111,8 +111,8 @@ public override void AfterCreate(IssueEventArgs args) QuickSlack.Send(data.Value.SlackAPIEndpoint, channel, string.Format("{0} created <{1}|{2} - {3}>" , args.User.Fullname, args.BuildIssueUrl(args.Entity), GetIssueKey(args), args.Entity.Title), "more details attached", - "good", - new[] { new { title = "Description", value = StripHTML(args.Entity.Description), _short = false } }); + "good", + new[] { new { title = "Description", value = StripHTML(args.Entity.Description), _short = false } }, StripHTML(args.Entity.Description)); base.AfterCreate(args); }