From c568682ad477865ffdbe39395f18a41ef6f07a20 Mon Sep 17 00:00:00 2001 From: Andrei Kurosh Date: Mon, 1 Jan 2024 20:03:51 +0100 Subject: [PATCH] Bugfix: initial user's page is added to the tree. Closes #259. --- src/Bonsai/Areas/Front/Controllers/AuthController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bonsai/Areas/Front/Controllers/AuthController.cs b/src/Bonsai/Areas/Front/Controllers/AuthController.cs index cc15a48..81959fa 100644 --- a/src/Bonsai/Areas/Front/Controllers/AuthController.cs +++ b/src/Bonsai/Areas/Front/Controllers/AuthController.cs @@ -1,12 +1,13 @@ using System; using System.Threading.Tasks; using Bonsai.Areas.Admin.Logic; +using Bonsai.Areas.Admin.Logic.Tree; using Bonsai.Areas.Front.Logic.Auth; using Bonsai.Areas.Front.ViewModels.Auth; using Bonsai.Code.Infrastructure; using Bonsai.Code.Services.Config; +using Bonsai.Code.Services.Jobs; using Bonsai.Code.Services.Search; -using Bonsai.Code.Utils; using Bonsai.Code.Utils.Helpers; using Bonsai.Code.Utils.Validation; using Bonsai.Data; @@ -30,6 +31,7 @@ public AuthController( PagesManagerService pages, ISearchEngine search, BonsaiConfigService cfgProvider, + IBackgroundJobService jobs, AppDbContext db ) { @@ -38,6 +40,7 @@ AppDbContext db _pages = pages; _search = search; _cfgProvider = cfgProvider; + _jobs = jobs; _db = db; } @@ -46,6 +49,7 @@ AppDbContext db private readonly PagesManagerService _pages; private readonly ISearchEngine _search; private readonly BonsaiConfigService _cfgProvider; + private readonly IBackgroundJobService _jobs; private readonly AppDbContext _db; /// @@ -196,6 +200,7 @@ public async Task Register(RegisterUserVM vm) await _db.SaveChangesAsync(); await _search.AddPageAsync(result.User.Page); + await _jobs.RunAsync(JobBuilder.For().SupersedeAll()); } return RedirectToAction("Index", "Home");