Skip to content

Commit ac53a6d

Browse files
authored
Merge branch 'v15/dev' into v15/feature/reworking-error-notifications
2 parents ad02cab + 5ee351a commit ac53a6d

File tree

70 files changed

+2477
-537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2477
-537
lines changed

src/Umbraco.Cms.Api.Management/Controllers/Member/MemberControllerBase.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.AspNetCore.Authorization;
1+
using Microsoft.AspNetCore.Authorization;
22
using Microsoft.AspNetCore.Http;
33
using Microsoft.AspNetCore.Mvc;
44
using Umbraco.Cms.Api.Common.Builders;
@@ -58,7 +58,8 @@ protected IActionResult MemberEditingOperationStatusResult(MemberEditingOperatio
5858
.WithTitle("Invalid name supplied")
5959
.Build()),
6060
MemberEditingOperationStatus.InvalidUsername => BadRequest(problemDetailsBuilder
61-
.WithTitle("Invalid username supplied")
61+
.WithTitle("Invalid username")
62+
.WithDetail("The username is either empty or contains one or more invalid characters.")
6263
.Build()),
6364
MemberEditingOperationStatus.InvalidEmail => BadRequest(problemDetailsBuilder
6465
.WithTitle("Invalid email supplied")

src/Umbraco.Cms.Api.Management/Controllers/User/UserOrCurrentUserControllerBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ protected IActionResult UserOperationStatusResult(UserOperationStatus status, Er
3535
.WithTitle("Email Cannot be changed")
3636
.WithDetail("Local login is disabled, so the email cannot be changed.")
3737
.Build()),
38+
UserOperationStatus.InvalidUserName => BadRequest(problemDetailsBuilder
39+
.WithTitle("Invalid username")
40+
.WithDetail("The username contains one or more invalid characters.")
41+
.Build()),
3842
UserOperationStatus.DuplicateUserName => BadRequest(problemDetailsBuilder
3943
.WithTitle("Duplicate Username")
4044
.WithDetail("The username is already in use.")

src/Umbraco.Cms.Api.Management/Factories/WebhookPresentationFactory.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public WebhookResponseModel CreateResponseModel(IWebhook webhook)
2929
var target = new WebhookResponseModel
3030
{
3131
Events = webhook.Events.Select(Create).ToArray(),
32+
Name = webhook.Name,
33+
Description = webhook.Description,
3234
Url = webhook.Url,
3335
Enabled = webhook.Enabled,
3436
Id = webhook.Key,
@@ -44,6 +46,8 @@ public IWebhook CreateWebhook(CreateWebhookRequestModel webhookRequestModel)
4446
var target = new Webhook(webhookRequestModel.Url, webhookRequestModel.Enabled, webhookRequestModel.ContentTypeKeys, webhookRequestModel.Events, webhookRequestModel.Headers)
4547
{
4648
Key = webhookRequestModel.Id ?? Guid.NewGuid(),
49+
Name = webhookRequestModel.Name,
50+
Description = webhookRequestModel.Description,
4751
};
4852
return target;
4953
}
@@ -53,6 +57,8 @@ public IWebhook CreateWebhook(UpdateWebhookRequestModel webhookRequestModel, Gui
5357
var target = new Webhook(webhookRequestModel.Url, webhookRequestModel.Enabled, webhookRequestModel.ContentTypeKeys, webhookRequestModel.Events, webhookRequestModel.Headers)
5458
{
5559
Key = existingWebhookkey,
60+
Name = webhookRequestModel.Name,
61+
Description = webhookRequestModel.Description,
5662
};
5763
return target;
5864
}

src/Umbraco.Cms.Api.Management/Mapping/Item/ItemTypeMapDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private static void Map(IUserGroup source, UserGroupItemResponseModel target, Ma
120120
// Umbraco.Code.MapAll
121121
private static void Map(IWebhook source, WebhookItemResponseModel target, MapperContext context)
122122
{
123-
target.Name = string.Empty; //source.Name;
123+
target.Name = source.Name ?? source.Url;
124124
target.Url = source.Url;
125125
target.Enabled = source.Enabled;
126126
target.Events = string.Join(",", source.Events);

src/Umbraco.Cms.Api.Management/OpenApi.json

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35940,6 +35940,14 @@
3594035940
"enabled": {
3594135941
"type": "boolean"
3594235942
},
35943+
"name": {
35944+
"type": "string",
35945+
"nullable": true
35946+
},
35947+
"description": {
35948+
"type": "string",
35949+
"nullable": true
35950+
},
3594335951
"url": {
3594435952
"minLength": 1,
3594535953
"type": "string"
@@ -36509,10 +36517,14 @@
3650936517
},
3651036518
"DefaultReferenceResponseModel": {
3651136519
"required": [
36520+
"$type",
3651236521
"id"
3651336522
],
3651436523
"type": "object",
3651536524
"properties": {
36525+
"$type": {
36526+
"type": "string"
36527+
},
3651636528
"id": {
3651736529
"type": "string",
3651836530
"format": "uuid"
@@ -36530,7 +36542,13 @@
3653036542
"nullable": true
3653136543
}
3653236544
},
36533-
"additionalProperties": false
36545+
"additionalProperties": false,
36546+
"discriminator": {
36547+
"propertyName": "$type",
36548+
"mapping": {
36549+
"DefaultReferenceResponseModel": "#/components/schemas/DefaultReferenceResponseModel"
36550+
}
36551+
}
3653436552
},
3653536553
"DeleteUserGroupsRequestModel": {
3653636554
"required": [
@@ -37050,11 +37068,15 @@
3705037068
},
3705137069
"DocumentReferenceResponseModel": {
3705237070
"required": [
37071+
"$type",
3705337072
"documentType",
3705437073
"id"
3705537074
],
3705637075
"type": "object",
3705737076
"properties": {
37077+
"$type": {
37078+
"type": "string"
37079+
},
3705837080
"id": {
3705937081
"type": "string",
3706037082
"format": "uuid"
@@ -37075,7 +37097,13 @@
3707537097
]
3707637098
}
3707737099
},
37078-
"additionalProperties": false
37100+
"additionalProperties": false,
37101+
"discriminator": {
37102+
"propertyName": "$type",
37103+
"mapping": {
37104+
"DocumentReferenceResponseModel": "#/components/schemas/DocumentReferenceResponseModel"
37105+
}
37106+
}
3707937107
},
3708037108
"DocumentResponseModel": {
3708137109
"required": [
@@ -39183,11 +39211,15 @@
3918339211
},
3918439212
"MediaReferenceResponseModel": {
3918539213
"required": [
39214+
"$type",
3918639215
"id",
3918739216
"mediaType"
3918839217
],
3918939218
"type": "object",
3919039219
"properties": {
39220+
"$type": {
39221+
"type": "string"
39222+
},
3919139223
"id": {
3919239224
"type": "string",
3919339225
"format": "uuid"
@@ -39204,7 +39236,13 @@
3920439236
]
3920539237
}
3920639238
},
39207-
"additionalProperties": false
39239+
"additionalProperties": false,
39240+
"discriminator": {
39241+
"propertyName": "$type",
39242+
"mapping": {
39243+
"MediaReferenceResponseModel": "#/components/schemas/MediaReferenceResponseModel"
39244+
}
39245+
}
3920839246
},
3920939247
"MediaResponseModel": {
3921039248
"required": [
@@ -45448,6 +45486,14 @@
4544845486
"enabled": {
4544945487
"type": "boolean"
4545045488
},
45489+
"name": {
45490+
"type": "string",
45491+
"nullable": true
45492+
},
45493+
"description": {
45494+
"type": "string",
45495+
"nullable": true
45496+
},
4545145497
"url": {
4545245498
"minLength": 1,
4545345499
"type": "string"
@@ -46339,6 +46385,14 @@
4633946385
"enabled": {
4634046386
"type": "boolean"
4634146387
},
46388+
"name": {
46389+
"type": "string",
46390+
"nullable": true
46391+
},
46392+
"description": {
46393+
"type": "string",
46394+
"nullable": true
46395+
},
4634246396
"url": {
4634346397
"minLength": 1,
4634446398
"type": "string"

src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/IReferenceResponseModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences;
1+
using Umbraco.Cms.Api.Common.OpenApi;
22

3-
public interface IReferenceResponseModel
3+
namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences;
4+
5+
public interface IReferenceResponseModel : IOpenApiDiscriminator
46
{
57
public Guid Id { get; }
68

src/Umbraco.Cms.Api.Management/ViewModels/Webhook/WebhookModelBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ public class WebhookModelBase
66
{
77
public bool Enabled { get; set; } = true;
88

9+
public string? Name { get; set; }
10+
11+
public string? Description { get; set; }
12+
913
[Required]
1014
public string Url { get; set; } = string.Empty;
1115

src/Umbraco.Core/Models/IWebhook.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
using Umbraco.Cms.Core.Models.Entities;
1+
using Umbraco.Cms.Core.Models.Entities;
22

33
namespace Umbraco.Cms.Core.Models;
44

55
public interface IWebhook : IEntity
66
{
7+
// TODO (V16): Remove the default implementations from this interface.
8+
string? Name
9+
{
10+
get { return null; }
11+
set { }
12+
}
13+
14+
string? Description
15+
{
16+
get { return null; }
17+
set { }
18+
}
19+
720
string Url { get; set; }
821

922
string[] Events { get; set; }

src/Umbraco.Core/Models/Webhook.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Umbraco.Cms.Core.Models.Entities;
1+
using Umbraco.Cms.Core.Models.Entities;
22
using Umbraco.Extensions;
33

44
namespace Umbraco.Cms.Core.Models;
@@ -24,6 +24,8 @@ private static readonly DelegateEqualityComparer<IDictionary<string, string>>
2424
(enumerable, translations) => enumerable.UnsortedSequenceEqual(translations),
2525
enumerable => enumerable.GetHashCode());
2626

27+
private string? _name;
28+
private string? _description;
2729
private string _url;
2830
private string[] _events;
2931
private Guid[] _contentTypeKeys;
@@ -39,6 +41,18 @@ public Webhook(string url, bool? enabled = null, Guid[]? entityKeys = null, stri
3941
_enabled = enabled ?? false;
4042
}
4143

44+
public string? Name
45+
{
46+
get => _name;
47+
set => SetPropertyValueAndDetectChanges(value, ref _name!, nameof(Name));
48+
}
49+
50+
public string? Description
51+
{
52+
get => _description;
53+
set => SetPropertyValueAndDetectChanges(value, ref _description!, nameof(Description));
54+
}
55+
4256
public string Url
4357
{
4458
get => _url;

src/Umbraco.Core/Services/OperationStatus/UserOperationStatus.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Umbraco.Cms.Core.Services.OperationStatus;
1+
namespace Umbraco.Cms.Core.Services.OperationStatus;
22

33
/// <summary>
44
/// Used to signal a user operation succeeded or an atomic failure reason
@@ -41,4 +41,5 @@ public enum UserOperationStatus
4141
SelfPasswordResetNotAllowed,
4242
DuplicateId,
4343
InvalidUserType,
44+
InvalidUserName,
4445
}

0 commit comments

Comments
 (0)