Browse Source

Merge branch 'master' of github.com:SebastianStehle/Squidex

pull/65/head
Sebastian Stehle 9 years ago
parent
commit
6f86491b84
  1. 2
      src/Squidex.Write/Apps/AppCommandHandler.cs
  2. 2
      src/Squidex/app/shared/components/assets-editor.component.ts
  3. 6
      tests/Squidex.Write.Tests/Apps/AppCommandHandlerTests.cs

2
src/Squidex.Write/Apps/AppCommandHandler.cs

@ -85,7 +85,7 @@ namespace Squidex.Write.Apps
a.AssignContributor(command);
if (a.ContributorCount > oldContributors && a.ContributorCount > maxContributors)
if (maxContributors > 0 && a.ContributorCount > oldContributors && a.ContributorCount > maxContributors)
{
var error = new ValidationError("You have reached your max number of contributors");

2
src/Squidex/app/shared/components/assets-editor.component.ts

@ -73,7 +73,7 @@ export class AssetsEditorComponent extends AppComponentBase implements ControlVa
public writeValue(value: any) {
this.oldAssets = ImmutableArray.empty<AssetDto>();
if (value) {
if (value && value.length > 0) {
this.appNameOnce()
.switchMap(app => this.assetsService.getAssets(app, 10000, 0, undefined, undefined, value))
.subscribe(dtos => {

6
tests/Squidex.Write.Tests/Apps/AppCommandHandlerTests.cs

@ -42,8 +42,6 @@ namespace Squidex.Write.Apps
public AppCommandHandlerTests()
{
appLimitsProvider.Setup(x => x.GetPlan(0)).Returns(new ConfigAppLimitsPlan { MaxContributors = 2 });
app = new AppDomainObject(AppId, -1);
sut = new AppCommandHandler(Handler, appRepository.Object, appLimitsProvider.Object, userRepository.Object, keyGenerator.Object);
@ -101,6 +99,8 @@ namespace Squidex.Write.Apps
[Fact]
public async Task AssignContributor_throw_if_reached_max_contributor_size()
{
appLimitsProvider.Setup(x => x.GetPlan(0)).Returns(new ConfigAppLimitsPlan { MaxContributors = 2 });
CreateApp()
.AssignContributor(CreateCommand(new AssignContributor { ContributorId = "1" }))
.AssignContributor(CreateCommand(new AssignContributor { ContributorId = "2" }));
@ -133,6 +133,8 @@ namespace Squidex.Write.Apps
[Fact]
public async Task AssignContributor_should_assign_if_user_found()
{
appLimitsProvider.Setup(x => x.GetPlan(0)).Returns(new ConfigAppLimitsPlan { MaxContributors = -1 });
CreateApp();
var context = CreateContextForCommand(new AssignContributor { ContributorId = contributorId });

Loading…
Cancel
Save