Bugfixes for MNTP / EntityController (#11685)
* Added EntityController.GetUrlsByIds support for int & guid + update MNTP Fixes issue with MNTP (for 8.18) in a partial view macro - GH #11631 Renamed GetUrlsByUdis to match, don't do this in v9 as it would be breaking there, instead mark it obsolete. TODO: v9 ensure integration test coverage, more painful here as no WebApplicationFactory. * Added partial test coverage for GetUrlsByIds. This doesn't actually work in the backoffice because of GH #11448 So lets fix that next. * Failing test demonstrating #11448 * Fix for #11448 getByIds doesn't work as expected. ParameterSwapControllerActionSelectorAttribute - cached body survived between requests. * Expand on sync vs async comment for future confused souls. * Might aswell cache parsed json vs string for performance * Make ParameterSwapControllerActionSelector remarks more accurate. * Share deserialized request body between action constraint and model binder * Be more defensive with RequestBodyAsJObject HttpContext item Only store if deserialize success. Don't assume key being present means can cast as JObject. * Nest constant a little deeper. * Final defensive tweak
This commit is contained in:
@@ -34,7 +34,7 @@ angular.module('umbraco.mocks').
|
||||
return [200, nodes, null];
|
||||
}
|
||||
|
||||
function returnUrlsbyUdis(status, data, headers) {
|
||||
function returnUrlsByIds(status, data, headers) {
|
||||
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
@@ -83,8 +83,8 @@ angular.module('umbraco.mocks').
|
||||
.respond(returnEntitybyIdsPost);
|
||||
|
||||
$httpBackend
|
||||
.whenPOST(mocksUtils.urlRegex('/umbraco/UmbracoApi/Entity/GetUrlsByUdis'))
|
||||
.respond(returnUrlsbyUdis);
|
||||
.whenPOST(mocksUtils.urlRegex('/umbraco/UmbracoApi/Entity/GetUrlsByIds'))
|
||||
.respond(returnUrlsByIds);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/Entity/GetAncestors'))
|
||||
|
||||
@@ -127,6 +127,24 @@ function entityResource($q, $http, umbRequestHelper) {
|
||||
'Failed to retrieve url for id:' + id);
|
||||
},
|
||||
|
||||
getUrlsByIds: function(ids, type, culture) {
|
||||
var query = `type=${type}&culture=${culture || ""}`;
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"entityApiBaseUrl",
|
||||
"GetUrlsByIds",
|
||||
query),
|
||||
{
|
||||
ids: ids
|
||||
}),
|
||||
'Failed to retrieve url map for ids ' + ids);
|
||||
},
|
||||
|
||||
/**
|
||||
* @deprecated use getUrlsByIds instead.
|
||||
*/
|
||||
getUrlsByUdis: function(udis, culture) {
|
||||
var query = "culture=" + (culture || "");
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ function contentPickerController($scope, $q, $routeParams, $location, entityReso
|
||||
|
||||
var requests = [
|
||||
entityResource.getByIds(missingIds, entityType),
|
||||
entityResource.getUrlsByUdis(missingIds)
|
||||
entityResource.getUrlsByIds(missingIds, entityType)
|
||||
];
|
||||
|
||||
return $q.all(requests).then(function ([data, urlMap]) {
|
||||
|
||||
Reference in New Issue
Block a user