diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs index 6fae7f86a..e4c9be516 100644 --- a/src/Ombi.Store/Context/OmbiContext.cs +++ b/src/Ombi.Store/Context/OmbiContext.cs @@ -146,7 +146,7 @@ namespace Ombi.Store.Context notificationToAdd = new NotificationTemplates { NotificationType = notificationType, - Message = "Hello! The user '{RequestedUser}' has requested the {Type} '{Title}'! Please log in to approve this request. Request Date: {RequestedDate}", + Message = "Hello! The user '{UserName}' has requested the {Type} '{Title}'! Please log in to approve this request. Request Date: {RequestedDate}", Subject = "{ApplicationName}: New {Type} request for {Title}!", Agent = agent, Enabled = true, @@ -156,7 +156,7 @@ namespace Ombi.Store.Context notificationToAdd = new NotificationTemplates { NotificationType = notificationType, - Message = "Hello! The user '{IssueUser}' has reported a new issue for the title {Title}!
{IssueCategory} - {IssueSubject} : {IssueDescription}", + Message = "Hello! The user '{UserName}' has reported a new issue for the title {Title}!
{IssueCategory} - {IssueSubject} : {IssueDescription}", Subject = "{ApplicationName}: New issue for {Title}!", Agent = agent, Enabled = true, @@ -166,7 +166,7 @@ namespace Ombi.Store.Context notificationToAdd = new NotificationTemplates { NotificationType = notificationType, - Message = "Hello! You requested {Title} on {ApplicationName}! This is now available! :)", + Message = "Hello! You {Title} on {ApplicationName}! This is now available! :)", Subject = "{ApplicationName}: {Title} is now available!", Agent = agent, Enabled = true, @@ -210,7 +210,7 @@ namespace Ombi.Store.Context notificationToAdd = new NotificationTemplates { NotificationType = notificationType, - Message = "Hello {IssueUser} Your issue for {Title} has now been resolved.", + Message = "Hello {UserName} Your issue for {Title} has now been resolved.", Subject = "{ApplicationName}: Issue has been resolved for {Title}!", Agent = agent, Enabled = true, diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index 6f05f2b51..aa3cf20db 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -129,7 +129,6 @@ export class TvSearchComponent implements OnInit { public getExtraInfo() { this.tvResults.forEach((val, index) => { - this.imageService.getTvBanner(val.data.id).subscribe(x => { val.data.background = this.sanitizer. diff --git a/src/Ombi/ClientApp/app/services/job.service.ts b/src/Ombi/ClientApp/app/services/job.service.ts index 94d73ec7e..79957af97 100644 --- a/src/Ombi/ClientApp/app/services/job.service.ts +++ b/src/Ombi/ClientApp/app/services/job.service.ts @@ -38,4 +38,8 @@ export class JobService extends ServiceHelpers { public runEmbyCacher(): Observable { return this.http.post(`${this.url}embycontentcacher/`, {headers: this.headers}); } + + public runNewsletter(): Observable { + return this.http.post(`${this.url}newsletter/`, {headers: this.headers}); + } } diff --git a/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html b/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html index b6e35ab23..9560cd333 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html +++ b/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html @@ -30,14 +30,18 @@ + + - NOTE: Please see the tooltip on the Update Database button. - When testing, the test newsletter will go to all users that have the Admin role, please ensure that there are valid email addresses for this. The test will also only grab the latest 10 movies and 10 shows just to give you an example. - +
+ NOTE: Please see the tooltip on the Update Database button - Please see the wiki for more information +
+
+ When testing, the test newsletter will go to all users that have the Admin role, please ensure that there are valid email addresses for this. The test will also only grab the latest 10 movies and 10 shows just to give you an example.
diff --git a/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.ts b/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.ts index 9c91cab10..2716b4604 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.ts @@ -1,9 +1,9 @@ - +import { } from './../../services/job.service'; + import { Component, OnInit } from "@angular/core"; import { INewsletterNotificationSettings, NotificationType } from "../../interfaces"; -import { NotificationService } from "../../services"; -import { SettingsService } from "../../services"; +import { JobService, NotificationService, SettingsService } from "../../services"; import { TesterService } from "./../../services/applications/tester.service"; @Component({ @@ -16,7 +16,8 @@ export class NewsletterComponent implements OnInit { constructor(private settingsService: SettingsService, private notificationService: NotificationService, - private testService: TesterService) { } + private testService: TesterService, + private jobService: JobService) { } public ngOnInit() { this.settingsService.getNewsletterSettings().subscribe(x => { @@ -26,10 +27,17 @@ export class NewsletterComponent implements OnInit { public updateDatabase() { this.settingsService.updateNewsletterDatabase().subscribe(); + this.notificationService.success("Database updated"); } public test() { this.testService.newsletterTest(this.settings).subscribe(); + this.notificationService.success("Test message queued"); + } + + public trigger() { + this.jobService.runNewsletter().subscribe(); + this.notificationService.success("Triggered newsletter job"); } public onSubmit() { diff --git a/src/Ombi/Controllers/JobController.cs b/src/Ombi/Controllers/JobController.cs index 5d2b3a5e9..76ca42c41 100644 --- a/src/Ombi/Controllers/JobController.cs +++ b/src/Ombi/Controllers/JobController.cs @@ -20,7 +20,7 @@ namespace Ombi.Controllers { public JobController(IOmbiAutomaticUpdater updater, IPlexUserImporter userImporter, ICacheService mem, IEmbyUserImporter embyImporter, IPlexContentSync plexContentSync, - IEmbyContentSync embyContentSync) + IEmbyContentSync embyContentSync, INewsletterJob newsletter) { _updater = updater; _plexUserImporter = userImporter; @@ -28,6 +28,7 @@ namespace Ombi.Controllers _memCache = mem; _plexContentSync = plexContentSync; _embyContentSync = embyContentSync; + _newsletterJob = newsletter; } private readonly IOmbiAutomaticUpdater _updater; @@ -36,6 +37,7 @@ namespace Ombi.Controllers private readonly ICacheService _memCache; private readonly IPlexContentSync _plexContentSync; private readonly IEmbyContentSync _embyContentSync; + private readonly INewsletterJob _newsletterJob; /// /// Runs the update job @@ -129,5 +131,16 @@ namespace Ombi.Controllers BackgroundJob.Enqueue(() => _embyContentSync.Start()); return true; } + + /// + /// Runs the newsletter + /// + /// + [HttpPost("newsletter")] + public bool StartNewsletter() + { + BackgroundJob.Enqueue(() => _newsletterJob.Start()); + return true; + } } } \ No newline at end of file