public Message ToSlackMessage(WorkItemChangedNotification notification, BotElement bot, string channel) { string header = notification.ToMessage(bot, s => s).First(); var fields = new[] { new AttachmentField(bot.Text.State, notification.State, true), new AttachmentField(bot.Text.AssignedTo, notification.AssignedTo, true) }; return SlackHelper.CreateSlackMessage(header, fields, bot, channel, bot.GetSetting("standardColor")); }
public Message ToSlackMessage(WorkItemChangedNotification notification, BotElement bot, string channel) { string header = notification.ToMessage(bot, s => s).First(); var fields = new List<AttachmentField>(); var searchType = notification.IsNew ? SearchFieldsType.Core : SearchFieldsType.Changed; var displayFieldsKey = notification.IsNew ? "wiCreatedDisplayFields" : "wiChangedDisplayFields"; foreach (var fieldId in bot.GetCsvSetting(displayFieldsKey, Defaults.WorkItemFields)) { var field = notification.GetUnifiedField(fieldId, searchType); if (field != null) { var fieldrep = notification.IsNew ? field.NewValue : bot.Text.WorkItemFieldTransitionFormat.FormatWith(field); fields.Add(new AttachmentField(field.Name, fieldrep, true)); } } return SlackHelper.CreateSlackMessage(header, fields, bot, channel, bot.GetSetting("standardColor")); }