Skip to content

Commit

Permalink
Merge pull request #8 from SaarCohen/master
Browse files Browse the repository at this point in the history
string html from change log
  • Loading branch information
thesoftwarejedi committed Jul 24, 2014
2 parents 925607a + 7cc6ab9 commit 0b94878
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions QuickSlack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions SlackListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -64,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) } });
"good",
new[] { new { title = "Comment", value = StripHTML(args.Entity.Comment), _short = false } }, StripHTML(args.Entity.Comment));

base.AfterComment(args);
}
Expand Down Expand Up @@ -110,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) } });
"good",
new[] { new { title = "Description", value = StripHTML(args.Entity.Description), _short = false } }, StripHTML(args.Entity.Description));

base.AfterCreate(args);
}
Expand Down Expand Up @@ -176,8 +177,8 @@ public override void AfterUpdateFull(IssueDtoEventArgs args)
.Select(a => new
{
title = a.Field,
value = a.FullChange,//. + " -> " + a.Object2Value,
_short = true
value = StripHTML(a.FullChange),
_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}>"
Expand Down
2 changes: 1 addition & 1 deletion app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<version-patch>0</version-patch>
<publisher>The Software Jedi</publisher>
<released>2014-07-07T11:31:00Z</released>
<debug>true</debug>
<debug>false</debug>
</app>

0 comments on commit 0b94878

Please sign in to comment.