Skip to content

Commit

Permalink
Bugfix: initial user's page is added to the tree. Closes #259.
Browse files Browse the repository at this point in the history
  • Loading branch information
impworks committed Jan 1, 2024
1 parent c4dbbb5 commit c568682
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Bonsai/Areas/Front/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -30,6 +31,7 @@ public AuthController(
PagesManagerService pages,
ISearchEngine search,
BonsaiConfigService cfgProvider,
IBackgroundJobService jobs,
AppDbContext db
)
{
Expand All @@ -38,6 +40,7 @@ AppDbContext db
_pages = pages;
_search = search;
_cfgProvider = cfgProvider;
_jobs = jobs;
_db = db;
}

Expand All @@ -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;

/// <summary>
Expand Down Expand Up @@ -196,6 +200,7 @@ public async Task<ActionResult> Register(RegisterUserVM vm)
await _db.SaveChangesAsync();

await _search.AddPageAsync(result.User.Page);
await _jobs.RunAsync(JobBuilder.For<EntireTreeLayoutJob>().SupersedeAll());
}

return RedirectToAction("Index", "Home");
Expand Down

0 comments on commit c568682

Please sign in to comment.