mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
enhanced the discord notifications #3611
This commit is contained in:
parent
51a886cef9
commit
31060fff61
5 changed files with 159 additions and 58 deletions
|
@ -64,6 +64,8 @@ namespace Ombi.Notifications
|
|||
}
|
||||
|
||||
AdditionalInformation = opts?.AdditionalInformation ?? string.Empty;
|
||||
|
||||
CalculateRequestStatus(req);
|
||||
}
|
||||
|
||||
public void Setup(NotificationOptions opts, AlbumRequest req, CustomizationSettings s, UserNotificationPreferences pref)
|
||||
|
@ -107,6 +109,7 @@ namespace Ombi.Notifications
|
|||
PosterImage = (req?.Cover.HasValue() ?? false) ? req.Cover : req?.Disk ?? string.Empty;
|
||||
|
||||
AdditionalInformation = opts?.AdditionalInformation ?? string.Empty;
|
||||
CalculateRequestStatus(req);
|
||||
}
|
||||
|
||||
public void SetupNewsletter(CustomizationSettings s)
|
||||
|
@ -197,6 +200,7 @@ namespace Ombi.Notifications
|
|||
|
||||
EpisodesList = epSb.ToString();
|
||||
SeasonsList = seasonSb.ToString();
|
||||
CalculateRequestStatus(req);
|
||||
}
|
||||
|
||||
public void Setup(OmbiUser user, CustomizationSettings s)
|
||||
|
@ -220,6 +224,30 @@ namespace Ombi.Notifications
|
|||
Type = opts.Substitutes.TryGetValue("RequestType", out val) ? val.Humanize() : string.Empty;
|
||||
}
|
||||
|
||||
private void CalculateRequestStatus(BaseRequest req)
|
||||
{
|
||||
RequestStatus = string.Empty;
|
||||
if (req != null)
|
||||
{
|
||||
if (req.Available)
|
||||
{
|
||||
RequestStatus = "Available";
|
||||
return;
|
||||
}
|
||||
if (req.Denied ?? false)
|
||||
{
|
||||
RequestStatus = "Denied";
|
||||
return;
|
||||
}
|
||||
if (!req.Available && req.Approved)
|
||||
{
|
||||
RequestStatus = "Processing Request";
|
||||
return;
|
||||
}
|
||||
RequestStatus = "Pending Approval";
|
||||
}
|
||||
}
|
||||
|
||||
// User Defined
|
||||
public string RequestId { get; set; }
|
||||
public string RequestedUser { get; set; }
|
||||
|
@ -245,6 +273,7 @@ namespace Ombi.Notifications
|
|||
public string UserPreference { get; set; }
|
||||
public string DenyReason { get; set; }
|
||||
public string AvailableDate { get; set; }
|
||||
public string RequestStatus { get; set; }
|
||||
|
||||
// System Defined
|
||||
private string LongDate => DateTime.Now.ToString("D");
|
||||
|
@ -282,6 +311,7 @@ namespace Ombi.Notifications
|
|||
{nameof(UserPreference),UserPreference},
|
||||
{nameof(DenyReason),DenyReason},
|
||||
{nameof(AvailableDate),AvailableDate},
|
||||
{nameof(RequestStatus),RequestStatus},
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue