mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
Fixed #1914
Also added new notification variables and a new notification when someone adds a comment on an issue.
This commit is contained in:
parent
b223306ee8
commit
480a107fa6
15 changed files with 322 additions and 42 deletions
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Notifications.Models;
|
||||
using Ombi.Settings.Settings.Models;
|
||||
|
@ -11,38 +10,58 @@ namespace Ombi.Notifications
|
|||
{
|
||||
public class NotificationMessageCurlys
|
||||
{
|
||||
|
||||
public void Setup(NotificationOptions opts, FullBaseRequest req, CustomizationSettings s)
|
||||
{
|
||||
LoadIssues(opts);
|
||||
string title;
|
||||
if (req == null)
|
||||
{
|
||||
opts.Substitutes.TryGetValue("Title", out title);
|
||||
}
|
||||
else
|
||||
{
|
||||
title = req?.Title;
|
||||
}
|
||||
ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty;
|
||||
ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName;
|
||||
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
||||
? req.RequestedUser.UserName
|
||||
: req.RequestedUser.Alias;
|
||||
Title = req.Title;
|
||||
RequestedDate = req.RequestedDate.ToString("D");
|
||||
Type = req.RequestType.ToString();
|
||||
Overview = req.Overview;
|
||||
Year = req.ReleaseDate.Year.ToString();
|
||||
PosterImage = req.RequestType == RequestType.Movie ?
|
||||
$"https://image.tmdb.org/t/p/w300{req.PosterPath}" : req.PosterPath;
|
||||
RequestedUser = string.IsNullOrEmpty(req?.RequestedUser?.Alias)
|
||||
? req?.RequestedUser?.UserName
|
||||
: req?.RequestedUser?.Alias;
|
||||
Title = title;
|
||||
RequestedDate = req?.RequestedDate.ToString("D");
|
||||
Type = req?.RequestType.ToString();
|
||||
Overview = req?.Overview;
|
||||
Year = req?.ReleaseDate.Year.ToString();
|
||||
PosterImage = req?.RequestType == RequestType.Movie ?
|
||||
string.Format("https://image.tmdb.org/t/p/w300{0}", req?.PosterPath) : req?.PosterPath;
|
||||
AdditionalInformation = opts?.AdditionalInformation ?? string.Empty;
|
||||
}
|
||||
|
||||
public void Setup(NotificationOptions opts, ChildRequests req, CustomizationSettings s)
|
||||
{
|
||||
|
||||
ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty;
|
||||
LoadIssues(opts);
|
||||
string title;
|
||||
if (req == null)
|
||||
{
|
||||
opts.Substitutes.TryGetValue("Title", out title);
|
||||
}
|
||||
else
|
||||
{
|
||||
title = req?.ParentRequest.Title;
|
||||
}
|
||||
ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty;
|
||||
ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName;
|
||||
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
||||
? req.RequestedUser.UserName
|
||||
: req.RequestedUser.Alias;
|
||||
Title = req.ParentRequest.Title;
|
||||
RequestedDate = req.RequestedDate.ToString("D");
|
||||
Type = req.RequestType.ToString();
|
||||
Overview = req.ParentRequest.Overview;
|
||||
Year = req.ParentRequest.ReleaseDate.Year.ToString();
|
||||
PosterImage = req.RequestType == RequestType.Movie ?
|
||||
$"https://image.tmdb.org/t/p/w300{req.ParentRequest.PosterPath}" : req.ParentRequest.PosterPath;
|
||||
RequestedUser = string.IsNullOrEmpty(req?.RequestedUser.Alias)
|
||||
? req?.RequestedUser.UserName
|
||||
: req?.RequestedUser.Alias;
|
||||
Title = title;
|
||||
RequestedDate = req?.RequestedDate.ToString("D");
|
||||
Type = req?.RequestType.ToString();
|
||||
Overview = req?.ParentRequest.Overview;
|
||||
Year = req?.ParentRequest.ReleaseDate.Year.ToString();
|
||||
PosterImage = req?.RequestType == RequestType.Movie ?
|
||||
$"https://image.tmdb.org/t/p/w300{req?.ParentRequest.PosterPath}" : req?.ParentRequest.PosterPath;
|
||||
AdditionalInformation = opts.AdditionalInformation;
|
||||
// DO Episode and Season Lists
|
||||
}
|
||||
|
@ -54,6 +73,16 @@ namespace Ombi.Notifications
|
|||
RequestedUser = user.UserName;
|
||||
}
|
||||
|
||||
private void LoadIssues(NotificationOptions opts)
|
||||
{
|
||||
var val = string.Empty;
|
||||
IssueDescription = opts.Substitutes.TryGetValue("IssueDescription", out val) ? val : string.Empty;
|
||||
IssueCategory = opts.Substitutes.TryGetValue("IssueCategory", out val) ? val : string.Empty;
|
||||
IssueStatus = opts.Substitutes.TryGetValue("IssueStatus", out val) ? val : string.Empty;
|
||||
IssueSubject = opts.Substitutes.TryGetValue("IssueSubject", out val) ? val : string.Empty;
|
||||
NewIssueComment = opts.Substitutes.TryGetValue("NewIssueComment", out val) ? val : string.Empty;
|
||||
}
|
||||
|
||||
// User Defined
|
||||
public string RequestedUser { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
@ -67,6 +96,11 @@ namespace Ombi.Notifications
|
|||
public string PosterImage { get; set; }
|
||||
public string ApplicationName { get; set; }
|
||||
public string ApplicationUrl { get; set; }
|
||||
public string IssueDescription { get; set; }
|
||||
public string IssueCategory { get; set; }
|
||||
public string IssueStatus { get; set; }
|
||||
public string IssueSubject { get; set; }
|
||||
public string NewIssueComment { get; set; }
|
||||
|
||||
// System Defined
|
||||
private string LongDate => DateTime.Now.ToString("D");
|
||||
|
@ -92,6 +126,11 @@ namespace Ombi.Notifications
|
|||
{nameof(PosterImage),PosterImage},
|
||||
{nameof(ApplicationName),ApplicationName},
|
||||
{nameof(ApplicationUrl),ApplicationUrl},
|
||||
{nameof(IssueDescription),IssueDescription},
|
||||
{nameof(IssueCategory),IssueCategory},
|
||||
{nameof(IssueStatus),IssueStatus},
|
||||
{nameof(IssueSubject),IssueSubject},
|
||||
{nameof(NewIssueComment),NewIssueComment},
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue