From 2f1060b665c0ffbde559158411bce7b380e18b86 Mon Sep 17 00:00:00 2001 From: anonaut Date: Tue, 14 Mar 2017 00:15:26 +0100 Subject: [PATCH] Added icon_url functionality to mattermost notification --- .../Notifications/MattermostNotificationBody.cs | 1 + .../SettingModels/MattermostNotificationSettings.cs | 1 + Ombi.Services/Notification/MattermostNotification.cs | 2 +- Ombi.UI/Views/Admin/MattermostNotifications.cshtml | 10 +++++++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Ombi.Api.Models/Notifications/MattermostNotificationBody.cs b/Ombi.Api.Models/Notifications/MattermostNotificationBody.cs index a179019cd..b804352e0 100644 --- a/Ombi.Api.Models/Notifications/MattermostNotificationBody.cs +++ b/Ombi.Api.Models/Notifications/MattermostNotificationBody.cs @@ -50,5 +50,6 @@ namespace Ombi.Api.Models.Notifications } public string channel { get; set; } public string text { get; set; } + public string icon_url { get; set; } } } \ No newline at end of file diff --git a/Ombi.Core/SettingModels/MattermostNotificationSettings.cs b/Ombi.Core/SettingModels/MattermostNotificationSettings.cs index 3ae1eeb8b..03ae5af3e 100644 --- a/Ombi.Core/SettingModels/MattermostNotificationSettings.cs +++ b/Ombi.Core/SettingModels/MattermostNotificationSettings.cs @@ -8,5 +8,6 @@ namespace Ombi.Core.SettingModels public string WebhookUrl { get; set; } public string Channel { get; set; } public string Username { get; set; } + public string IconUrl { get; set; } } } \ No newline at end of file diff --git a/Ombi.Services/Notification/MattermostNotification.cs b/Ombi.Services/Notification/MattermostNotification.cs index 9d8cdbaf9..708e8df34 100644 --- a/Ombi.Services/Notification/MattermostNotification.cs +++ b/Ombi.Services/Notification/MattermostNotification.cs @@ -125,7 +125,7 @@ namespace Ombi.Services.Notification { try { - var notification = new MattermostNotificationBody { username = config.Username, channel = config.Channel ?? string.Empty, text = message }; + var notification = new MattermostNotificationBody { username = config.Username, channel = config.Channel ?? string.Empty, icon_url = config.IconUrl ?? string.Empty, text = message }; var result = await Api.PushAsync(config.WebhookUrl, notification); if (!result.Equals("ok")) diff --git a/Ombi.UI/Views/Admin/MattermostNotifications.cshtml b/Ombi.UI/Views/Admin/MattermostNotifications.cshtml index 10d04e7c1..b48256319 100644 --- a/Ombi.UI/Views/Admin/MattermostNotifications.cshtml +++ b/Ombi.UI/Views/Admin/MattermostNotifications.cshtml @@ -24,7 +24,7 @@
This is the full webhook url. - Mattermost > Settings > Add app or integration > Build > Make a Custom Integration > Incoming Webhooks > Add Incoming Webhook. You will then have a Webhook Url + Mattermost > Integrations > Incoming Webhook > Add Incoming Webhook. You will then have a Webhook Url
@@ -46,6 +46,14 @@
+
+ + You can override the default icon here +
+ +
+
+