|
|
|
@ -41,27 +41,26 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models |
|
|
|
|
|
|
|
var result = new ContributorsDto |
|
|
|
{ |
|
|
|
Items = |
|
|
|
app.Contributors |
|
|
|
.Select(x => ContributorDto.FromIdAndRole(x.Key, x.Value)) |
|
|
|
.Select(x => x.WithUser(users)) |
|
|
|
.Select(x => x.WithLinks(resources)) |
|
|
|
.OrderBy(x => x.ContributorName) |
|
|
|
.ToArray() |
|
|
|
Items = app.Contributors |
|
|
|
.Select(x => ContributorDto.FromIdAndRole(x.Key, x.Value)) |
|
|
|
.Select(x => x.CreateUser(users)) |
|
|
|
.Select(x => x.CreateLinks(resources)) |
|
|
|
.OrderBy(x => x.ContributorName) |
|
|
|
.ToArray() |
|
|
|
}; |
|
|
|
|
|
|
|
result.WithInvited(invited); |
|
|
|
result.WithPlan(app, plans); |
|
|
|
result.CreateInvited(invited); |
|
|
|
result.CreatePlan(app, plans); |
|
|
|
|
|
|
|
return result.CreateLinks(resources, app.Name); |
|
|
|
return result.CreateLinks(resources); |
|
|
|
} |
|
|
|
|
|
|
|
private void WithPlan(IAppEntity app, IAppPlansProvider plans) |
|
|
|
private void CreatePlan(IAppEntity app, IAppPlansProvider plans) |
|
|
|
{ |
|
|
|
MaxContributors = plans.GetPlanForApp(app).Plan.MaxContributors; |
|
|
|
} |
|
|
|
|
|
|
|
private void WithInvited(bool isInvited) |
|
|
|
private void CreateInvited(bool isInvited) |
|
|
|
{ |
|
|
|
if (isInvited) |
|
|
|
{ |
|
|
|
@ -72,9 +71,9 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private ContributorsDto CreateLinks(Resources resources, string app) |
|
|
|
private ContributorsDto CreateLinks(Resources resources) |
|
|
|
{ |
|
|
|
var values = new { app }; |
|
|
|
var values = new { app = resources.App }; |
|
|
|
|
|
|
|
AddSelfLink(resources.Url<AppContributorsController>(x => nameof(x.GetContributors), values)); |
|
|
|
|
|
|
|
|