mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 14:10:50 -07:00
Resolved #75
This commit is contained in:
parent
0585ff73ec
commit
f64ccd7327
2 changed files with 24 additions and 3 deletions
|
@ -77,7 +77,15 @@ namespace PlexRequests.Services.Notification
|
||||||
|
|
||||||
private bool ValidateConfiguration()
|
private bool ValidateConfiguration()
|
||||||
{
|
{
|
||||||
return !Settings.Enabled && !string.IsNullOrEmpty(Settings.AccessToken);
|
if (!Settings.Enabled)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(Settings.AccessToken))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PushbulletNotificationSettings GetSettings()
|
private PushbulletNotificationSettings GetSettings()
|
||||||
|
@ -106,8 +114,8 @@ namespace PlexRequests.Services.Notification
|
||||||
|
|
||||||
private bool PushIssue(NotificationModel model)
|
private bool PushIssue(NotificationModel model)
|
||||||
{
|
{
|
||||||
var message = $"A new issue: {model.Title} has been reported by user: {model.User} for the title: {model.Body}";
|
var message = $"A new issue: {model.Body} has been reported by user: {model.User} for the title: {model.Title}";
|
||||||
var pushTitle = $"Plex Requests: A new issue has been reported for {model.Body}";
|
var pushTitle = $"Plex Requests: A new issue has been reported for {model.Title}";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = PushbulletApi.Push(Settings.AccessToken, pushTitle, message, Settings.DeviceIdentifier);
|
var result = PushbulletApi.Push(Settings.AccessToken, pushTitle, message, Settings.DeviceIdentifier);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ using Nancy.Security;
|
||||||
using PlexRequests.Api;
|
using PlexRequests.Api;
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Services.Notification;
|
||||||
using PlexRequests.Store;
|
using PlexRequests.Store;
|
||||||
using PlexRequests.UI.Models;
|
using PlexRequests.UI.Models;
|
||||||
|
|
||||||
|
@ -166,6 +168,17 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
|
|
||||||
var result = Service.UpdateRequest(originalRequest);
|
var result = Service.UpdateRequest(originalRequest);
|
||||||
|
|
||||||
|
var model = new NotificationModel
|
||||||
|
{
|
||||||
|
User = Session[SessionKeys.UsernameKey].ToString(),
|
||||||
|
NotificationType = NotificationType.Issue,
|
||||||
|
Title = originalRequest.Title,
|
||||||
|
DateTime = DateTime.Now,
|
||||||
|
Body = issue == IssueState.Other ? comment : issue.Humanize()
|
||||||
|
};
|
||||||
|
NotificationService.Publish(model);
|
||||||
|
|
||||||
return Response.AsJson(result
|
return Response.AsJson(result
|
||||||
? new JsonResponseModel { Result = true }
|
? new JsonResponseModel { Result = true }
|
||||||
: new JsonResponseModel { Result = false, Message = "Could not add issue, please try again or contact the administrator!" });
|
: new JsonResponseModel { Result = false, Message = "Could not add issue, please try again or contact the administrator!" });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue