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"))); }
internal static Message CreateMsTeamsMessage(WorkItemChangedNotification notification, BotElement bot) { string heading = notification.ToMessage(bot, s => s).First(); var facts = new List <Fact>(); 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); facts.Add(new Fact(field.Name, fieldrep)); } } return(CreateMsTeamsMessage(heading, facts, bot.GetSetting("standardColor"))); }