mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 08:42:57 -07:00
Fixed the issue where user preferences was not being inported into some notifications
This commit is contained in:
parent
afc55e6f1f
commit
65233cb3b7
2 changed files with 21 additions and 2 deletions
|
@ -170,6 +170,24 @@ namespace Ombi.Notifications.Interfaces
|
||||||
{
|
{
|
||||||
return new NotificationMessageContent { Disabled = true };
|
return new NotificationMessageContent { Disabled = true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model.UserId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
if (model.RequestType == RequestType.Movie)
|
||||||
|
{
|
||||||
|
model.UserId = MovieRequest.RequestedUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.RequestType == RequestType.Album)
|
||||||
|
{
|
||||||
|
model.UserId = AlbumRequest.RequestedUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.RequestType == RequestType.TvShow)
|
||||||
|
{
|
||||||
|
model.UserId = TvRequest.RequestedUserId;
|
||||||
|
}
|
||||||
|
}
|
||||||
var parsed = Parse(model, template, agent);
|
var parsed = Parse(model, template, agent);
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
|
@ -184,7 +202,7 @@ namespace Ombi.Notifications.Interfaces
|
||||||
protected UserNotificationPreferences GetUserPreference(string userId, NotificationAgent agent)
|
protected UserNotificationPreferences GetUserPreference(string userId, NotificationAgent agent)
|
||||||
{
|
{
|
||||||
return UserNotificationPreferences.GetAll()
|
return UserNotificationPreferences.GetAll()
|
||||||
.FirstOrDefault(x => x.Enabled && x.Agent == agent && x.UserId == userId);
|
.FirstOrDefault(x => x.Agent == agent && x.UserId == userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NotificationMessageContent Parse(NotificationOptions model, NotificationTemplates template, NotificationAgent agent)
|
private NotificationMessageContent Parse(NotificationOptions model, NotificationTemplates template, NotificationAgent agent)
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Ombi.Notifications
|
||||||
LoadIssues(opts);
|
LoadIssues(opts);
|
||||||
if (pref != null)
|
if (pref != null)
|
||||||
{
|
{
|
||||||
UserPreference = pref.Enabled ? pref.Value : string.Empty;
|
UserPreference = pref.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
string title;
|
string title;
|
||||||
|
@ -268,6 +268,7 @@ namespace Ombi.Notifications
|
||||||
{nameof(IssueUser),IssueUser},
|
{nameof(IssueUser),IssueUser},
|
||||||
{nameof(UserName),UserName},
|
{nameof(UserName),UserName},
|
||||||
{nameof(Alias),Alias},
|
{nameof(Alias),Alias},
|
||||||
|
{nameof(UserPreference),UserPreference},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue