mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Small changes for the mobile notification
This commit is contained in:
parent
9c67607f95
commit
0f315ebe3b
4 changed files with 40 additions and 25 deletions
|
@ -53,9 +53,11 @@ namespace Ombi.Notifications.Agents
|
|||
_logger.LogInformation($"Template {NotificationType.NewRequest} is disabled for {NotificationAgent.Mobile}");
|
||||
return;
|
||||
}
|
||||
|
||||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = GetNotificationData(parsed, NotificationType.NewRequest)
|
||||
};
|
||||
|
||||
// Get admin devices
|
||||
|
@ -74,6 +76,7 @@ namespace Ombi.Notifications.Agents
|
|||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = GetNotificationData(parsed, NotificationType.Issue)
|
||||
};
|
||||
|
||||
// Get admin devices
|
||||
|
@ -92,6 +95,7 @@ namespace Ombi.Notifications.Agents
|
|||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = GetNotificationData(parsed, NotificationType.IssueComment)
|
||||
};
|
||||
if (model.Substitutes.TryGetValue("AdminComment", out var isAdminString))
|
||||
{
|
||||
|
@ -123,6 +127,7 @@ namespace Ombi.Notifications.Agents
|
|||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = GetNotificationData(parsed, NotificationType.IssueResolved)
|
||||
};
|
||||
|
||||
// Send to user
|
||||
|
@ -144,6 +149,7 @@ namespace Ombi.Notifications.Agents
|
|||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = GetNotificationData(parsed, NotificationType.ItemAddedToFaultQueue)
|
||||
};
|
||||
|
||||
// Get admin devices
|
||||
|
@ -162,6 +168,7 @@ namespace Ombi.Notifications.Agents
|
|||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = GetNotificationData(parsed, NotificationType.RequestDeclined)
|
||||
};
|
||||
|
||||
// Send to user
|
||||
|
@ -181,6 +188,7 @@ namespace Ombi.Notifications.Agents
|
|||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = GetNotificationData(parsed, NotificationType.RequestApproved)
|
||||
};
|
||||
|
||||
// Send to user
|
||||
|
@ -198,9 +206,13 @@ namespace Ombi.Notifications.Agents
|
|||
_logger.LogInformation($"Template {NotificationType.RequestAvailable} is disabled for {NotificationAgent.Mobile}");
|
||||
return;
|
||||
}
|
||||
|
||||
var data = GetNotificationData(parsed, NotificationType.RequestAvailable);
|
||||
|
||||
var notification = new NotificationMessage
|
||||
{
|
||||
Message = parsed.Message,
|
||||
Data = data
|
||||
};
|
||||
// Send to user
|
||||
var playerIds = GetUsers(model, NotificationType.RequestAvailable);
|
||||
|
@ -208,6 +220,14 @@ namespace Ombi.Notifications.Agents
|
|||
await AddSubscribedUsers(playerIds);
|
||||
await Send(playerIds, notification, settings, model);
|
||||
}
|
||||
|
||||
private static Dictionary<string,string> GetNotificationData(NotificationMessageContent parsed, NotificationType type)
|
||||
{
|
||||
var notificationData = parsed.Data.ToDictionary(x => x.Key, x => x.Value);
|
||||
notificationData[nameof(NotificationType)] = type.ToString();
|
||||
return notificationData;
|
||||
}
|
||||
|
||||
protected override Task Send(NotificationMessage model, MobileNotificationSettings settings)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -225,7 +245,8 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
Body = model.Message,
|
||||
Title = model.Subject,
|
||||
To = token
|
||||
To = token,
|
||||
Data = new Dictionary<string, string>(model.Data)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ namespace Ombi.Notifications
|
|||
{
|
||||
public class NotificationMessageCurlys
|
||||
{
|
||||
public void Setup(NotificationOptions opts, FullBaseRequest req, CustomizationSettings s, UserNotificationPreferences pref)
|
||||
public void Setup(NotificationOptions opts, MovieRequests req, CustomizationSettings s, UserNotificationPreferences pref)
|
||||
{
|
||||
LoadIssues(opts);
|
||||
|
||||
RequestId = req?.Id.ToString();
|
||||
|
||||
ProviderId = req?.TheMovieDbId.ToString() ?? string.Empty;
|
||||
string title;
|
||||
if (req == null)
|
||||
{
|
||||
|
@ -73,6 +73,7 @@ namespace Ombi.Notifications
|
|||
LoadIssues(opts);
|
||||
|
||||
RequestId = req?.Id.ToString();
|
||||
ProviderId = req?.ForeignArtistId ?? string.Empty;
|
||||
|
||||
string title;
|
||||
if (req == null)
|
||||
|
@ -122,6 +123,7 @@ namespace Ombi.Notifications
|
|||
{
|
||||
LoadIssues(opts);
|
||||
RequestId = req.Id.ToString();
|
||||
ProviderId = req?.ParentRequest?.TvDbId.ToString() ?? string.Empty;
|
||||
string title;
|
||||
if (req == null)
|
||||
{
|
||||
|
@ -274,6 +276,7 @@ namespace Ombi.Notifications
|
|||
public string DenyReason { get; set; }
|
||||
public string AvailableDate { get; set; }
|
||||
public string RequestStatus { get; set; }
|
||||
public string ProviderId { get; set; }
|
||||
|
||||
// System Defined
|
||||
private string LongDate => DateTime.Now.ToString("D");
|
||||
|
@ -312,6 +315,7 @@ namespace Ombi.Notifications
|
|||
{nameof(DenyReason),DenyReason},
|
||||
{nameof(AvailableDate),AvailableDate},
|
||||
{nameof(RequestStatus),RequestStatus},
|
||||
{nameof(ProviderId),ProviderId},
|
||||
};
|
||||
}
|
||||
}
|
|
@ -118,28 +118,18 @@ export class UserManagementUserComponent implements OnInit {
|
|||
}
|
||||
|
||||
public delete() {
|
||||
// TODO
|
||||
// this.confirmationService.confirm({
|
||||
// message: "Are you sure that you want to delete this user? If this user has any requests they will also be deleted.",
|
||||
// header: "Are you sure?",
|
||||
// icon: "fa fa-trash",
|
||||
// accept: () => {
|
||||
// this.identityService.deleteUser(this.user).subscribe(x => {
|
||||
// if (x.successful) {
|
||||
// this.notificationService.send(`The user ${this.user.userName} was deleted`);
|
||||
// this.router.navigate(["usermanagement"]);
|
||||
// } else {
|
||||
// x.errors.forEach((val) => {
|
||||
// this.notificationService.send(val);
|
||||
// });
|
||||
// }
|
||||
|
||||
// });
|
||||
// },
|
||||
// reject: () => {
|
||||
// return;
|
||||
// },
|
||||
// });
|
||||
this.identityService.deleteUser(this.user).subscribe(x => {
|
||||
if (x.successful) {
|
||||
this.notificationService.send(`The user ${this.user.userName} was deleted`);
|
||||
this.router.navigate(["usermanagement"]);
|
||||
} else {
|
||||
x.errors.forEach((val) => {
|
||||
this.notificationService.send(val);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public resetPassword() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue