diff --git a/BTCPayServer/Controllers/NoticeController.cs b/BTCPayServer/Controllers/NotificationController.cs similarity index 82% rename from BTCPayServer/Controllers/NoticeController.cs rename to BTCPayServer/Controllers/NotificationController.cs index 1bb4b084c..ef505e984 100644 --- a/BTCPayServer/Controllers/NoticeController.cs +++ b/BTCPayServer/Controllers/NotificationController.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BTCPayServer.Events.Notifications; using BTCPayServer.Filters; -using BTCPayServer.Models.NoticeViewModels; +using BTCPayServer.Models.NotificationViewModels; using BTCPayServer.Security; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -12,11 +13,17 @@ using Microsoft.AspNetCore.Mvc; namespace BTCPayServer.Controllers { [BitpayAPIConstraint(false)] - public class NoticeController : Controller + [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)] + public class NotificationController : Controller { + private readonly EventAggregator _eventAggregator; + + public NotificationController(EventAggregator eventAggregator) + { + _eventAggregator = eventAggregator; + } + [HttpGet] - [Route("notices")] - [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)] public async Task Index(int skip = 0, int count = 50, int timezoneOffset = 0) { var model = new IndexViewModel() @@ -70,5 +77,12 @@ namespace BTCPayServer.Controllers model.Items = model.Items.OrderByDescending(a => a.Created).ToList(); return View(model); } + + [HttpGet] + public async Task Generate() + { + _eventAggregator.NoticeNewVersion("1.1.1"); + return RedirectToAction(nameof(Index)); + } } } diff --git a/BTCPayServer/Models/NoticeViewModels/IndexViewModel.cs b/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs similarity index 89% rename from BTCPayServer/Models/NoticeViewModels/IndexViewModel.cs rename to BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs index ec37244cb..34d8b6999 100644 --- a/BTCPayServer/Models/NoticeViewModels/IndexViewModel.cs +++ b/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BTCPayServer.Models.NoticeViewModels +namespace BTCPayServer.Models.NotificationViewModels { public class IndexViewModel { diff --git a/BTCPayServer/Views/Notice/_ViewImports.cshtml b/BTCPayServer/Views/Notice/_ViewImports.cshtml deleted file mode 100644 index 517d49aa2..000000000 --- a/BTCPayServer/Views/Notice/_ViewImports.cshtml +++ /dev/null @@ -1 +0,0 @@ -@using BTCPayServer.Models.NoticeViewModels diff --git a/BTCPayServer/Views/Notice/Index.cshtml b/BTCPayServer/Views/Notification/Index.cshtml similarity index 95% rename from BTCPayServer/Views/Notice/Index.cshtml rename to BTCPayServer/Views/Notification/Index.cshtml index d463caf1c..ae87b8e94 100644 --- a/BTCPayServer/Views/Notice/Index.cshtml +++ b/BTCPayServer/Views/Notification/Index.cshtml @@ -1,4 +1,4 @@ -@model BTCPayServer.Models.NoticeViewModels.IndexViewModel +@model BTCPayServer.Models.NotificationViewModels.IndexViewModel @{ ViewData["Title"] = "Notices"; } diff --git a/BTCPayServer/Views/Notification/_ViewImports.cshtml b/BTCPayServer/Views/Notification/_ViewImports.cshtml new file mode 100644 index 000000000..e02abfc9b --- /dev/null +++ b/BTCPayServer/Views/Notification/_ViewImports.cshtml @@ -0,0 +1 @@ + diff --git a/BTCPayServer/Views/Shared/_Layout.cshtml b/BTCPayServer/Views/Shared/_Layout.cshtml index 132a814de..74db5f645 100644 --- a/BTCPayServer/Views/Shared/_Layout.cshtml +++ b/BTCPayServer/Views/Shared/_Layout.cshtml @@ -79,7 +79,7 @@