Skip to content

Commit

Permalink
#22921 include in 23.10.24
Browse files Browse the repository at this point in the history
  • Loading branch information
erickgonzalez committed Feb 16, 2024
1 parent f2c22b0 commit 953635f
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dotCMS/hotfix_tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ This maintenance release includes the following code fixes:
40. https://github.com/dotCMS/core/issues/26796 : Reserved names fields should be compared in a case-insensitive manner to avoid errors and inconsistencies. #26796
40. https://github.com/dotCMS/core/issues/26680 : Restoring Reorder Rows Functionality in Content Type Editing #26680
41. https://github.com/dotCMS/core/issues/26774 : text fields validation limit to 255 chars is not longer required #26774
42. https://github.com/dotCMS/core/issues/26605 : Relation_type field too small #26605
42. https://github.com/dotCMS/core/issues/26605 : Relation_type field too small #26605
43. https://github.com/dotCMS/core/issues/22921 : Workflow API unable to archive contentlet #22921
158 changes: 158 additions & 0 deletions dotCMS/src/curl-test/Workflow_Resource_Tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -16326,6 +16326,164 @@
"response": []
}
]
},
{
"name": "fireActionByName",
"item": [
{
"name": "testArchiveContentlet",
"item": [
{
"name": "Create ContentType",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = pm.response.json();",
"",
"pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);",
"pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);",
"pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);",
"",
"pm.test(\"Status code should be ok 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"fields check\", function () {",
" pm.expect(jsonData.entity[0].fields.length).to.eql(1);",
"});",
"",
"pm.test(\"description check\", function () {",
" pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": {
"password": "admin",
"username": "[email protected]",
"showPassword": false
}
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Content Type Test\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"title\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n"
},
"url": "{{serverURL}}/api/v1/contenttype",
"description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)."
},
"response": []
},
{
"name": "Create contentlet",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = pm.response.json();",
"",
"pm.test(\"Status code should be ok 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.collectionVariables.set(\"contentletID\", jsonData.entity.identifier);",
"pm.collectionVariables.set(\"contentletInode\", jsonData.entity.inode);"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": {
"password": "admin",
"username": "[email protected]"
}
},
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"{{contentTypeVAR}}\",\n\t\t\"title\": \"test contentlet\"\n\t}\n}"
},
"url": "http://localhost:8080/api/v1/workflow/actions/default/fire/NEW"
},
"response": []
},
{
"name": "Archive contentlet",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = pm.response.json();",
"",
"pm.test(\"Status code should be ok 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Test the variable value\", function () {",
" var jsonData = pm.response.json();",
" var expectedValue = pm.collectionVariables.get(\"contentletID\");",
" pm.expect(jsonData.entity.identifier).to.eql(expectedValue);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": {
"password": "admin",
"username": "[email protected]",
"showPassword": false
}
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": " {\n \"actionName\": \"Archive\",\n \"contentlet\" : {\n \"identifier\": \"{{contentletID}}\",\n \"inode\": \"{{contentletInode}}\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": "{{serverURL}}/api/v1/workflow/actions/fire"
},
"response": []
}
]
}
]
}
],
"event": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,9 @@ private Contentlet createContentlet(final FireActionForm fireActionForm,

contentlet = this.populateContentlet(fireActionForm, contentlet, initDataObject.getUser(),mode);
}
if (contentlet.getInode().isEmpty() && !currentContentlet.getInode().isEmpty()) {
contentlet.setInode(currentContentlet.getInode());
}
return contentlet;
}

Expand Down

0 comments on commit 953635f

Please sign in to comment.