Browse Source

Fix for restore.

pull/362/head
Sebastian Stehle 7 years ago
parent
commit
e74af88da2
  1. 2
      src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs
  2. 25
      src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs
  3. 15
      src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs
  4. 4
      src/Squidex/appsettings.json

2
src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs

@ -56,7 +56,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards
e(Not.New("Contributor", "role"), nameof(command.Role)); e(Not.New("Contributor", "role"), nameof(command.Role));
} }
} }
else if (plan.MaxContributors == contributors.Count) else if (contributors.Count >= plan.MaxContributors && !command.IsRestore)
{ {
e("You have reached the maximum number of contributors for your plan."); e("You have reached the maximum number of contributors for your plan.");
} }

25
src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs

@ -246,16 +246,23 @@ namespace Squidex.Domain.Apps.Entities.Backup
if (actor?.IsSubject == true) if (actor?.IsSubject == true)
{ {
await commandBus.PublishAsync(new AssignContributor try
{ {
Actor = actor, await commandBus.PublishAsync(new AssignContributor
AppId = CurrentJob.AppId, {
ContributorId = actor.Identifier, Actor = actor,
IsRestore = true, AppId = CurrentJob.AppId,
Role = Role.Owner ContributorId = actor.Identifier,
}); IsRestore = true,
Role = Role.Owner
Log("Assigned current user."); });
Log("Assigned current user.");
}
catch (DomainException ex)
{
Log($"Failed to assign contributor: {ex.Message}");
}
} }
else else
{ {

15
src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs

@ -52,16 +52,19 @@ namespace Squidex.Areas.Frontend.Middlewares
await next(context); await next(context);
context.Response.Body = responseBody; if (context.Response.StatusCode != 304)
{
context.Response.Body = responseBody;
var html = Encoding.UTF8.GetString(responseBuffer.ToArray()); var html = Encoding.UTF8.GetString(responseBuffer.ToArray());
html = AdjustBase(html, context.Request.PathBase); html = AdjustBase(html, context.Request.PathBase);
context.Response.ContentLength = Encoding.UTF8.GetByteCount(html); context.Response.ContentLength = Encoding.UTF8.GetByteCount(html);
context.Response.Body = responseBody; context.Response.Body = responseBody;
await context.Response.WriteAsync(html); await context.Response.WriteAsync(html);
}
} }
else else
{ {

4
src/Squidex/appsettings.json

@ -104,7 +104,7 @@
/* /*
* The email body when a new user is added as contributor. * The email body when a new user is added as contributor.
*/ */
"newUserBody": "Welcome to Squidex\r\nDear User,\r\n\r\n{{$ASSIGNER_NAME}} ($ASSIGNER_EMAIL) has invited you to join Project (also called an App) {{var:app_name}} at Squidex Headless CMS. Login with your Github, Google or Microsoft credentials to create a new user account and start editing content now.\r\n\r\nThank you very much,\r\nThe Squidex Team\r\n\r\n<<Start now!>> [$UI_URL]", "newUserBody": "Welcome to Squidex\r\nDear User,\r\n\r\n$ASSIGNER_NAME ($ASSIGNER_EMAIL) has invited you to join Project (also called an App) $APP_NAME at Squidex Headless CMS. Login with your Github, Google or Microsoft credentials to create a new user account and start editing content now.\r\n\r\nThank you very much,\r\nThe Squidex Team\r\n\r\n<<Start now!>> [$UI_URL]",
/* /*
* The email subject when an existing user is added as contributor. * The email subject when an existing user is added as contributor.
*/ */
@ -112,7 +112,7 @@
/* /*
* The email body when an existing user is added as contributor. * The email body when an existing user is added as contributor.
*/ */
"existingUserBody": "Dear User,\r\n\r\n{{$ASSIGNER_NAME}} ($ASSIGNER_EMAIL) has invited you to join App {{var:app_name}} at Squidex Headless CMS.\r\n\r\nLogin or reload the Management UI to see the App.\r\n\r\nThank you very much,\r\nThe Squidex Team\r\n\r\n<<Start now!>> [$UI_URL]" "existingUserBody": "Dear User,\r\n\r\n$ASSIGNER_NAME ($ASSIGNER_EMAIL) has invited you to join App $APP_NAME at Squidex Headless CMS.\r\n\r\nLogin or reload the Management UI to see the App.\r\n\r\nThank you very much,\r\nThe Squidex Team\r\n\r\n<<Start now!>> [$UI_URL]"
} }
}, },

Loading…
Cancel
Save