Merge remote-tracking branch 'origin/temp8' into feature/IContentType-removale-from-IContent

# Conflicts:
#	src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
This commit is contained in:
Bjarke Berg
2019-02-01 12:52:20 +01:00
1566 changed files with 18277 additions and 26409 deletions

View File

@@ -164,7 +164,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns><see cref="IContent"/></returns>
public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = 0)
{
//fixme - what about culture?
// TODO: what about culture?
var parent = GetById(parentId);
return Create(name, parent, contentTypeAlias, userId);
@@ -184,7 +184,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns>The content object.</returns>
public IContent Create(string name, int parentId, string contentTypeAlias, int userId = 0)
{
//fixme - what about culture?
// TODO: what about culture?
var contentType = GetContentType(contentTypeAlias);
if (contentType == null)
@@ -217,7 +217,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns>The content object.</returns>
public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = 0)
{
//fixme - what about culture?
// TODO: what about culture?
if (parent == null) throw new ArgumentNullException(nameof(parent));
@@ -248,7 +248,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns>The content object.</returns>
public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = 0)
{
//fixme - what about culture?
// TODO: what about culture?
using (var scope = ScopeProvider.CreateScope())
{
@@ -282,7 +282,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns>The content object.</returns>
public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = 0)
{
//fixme - what about culture?
// TODO: what about culture?
if (parent == null) throw new ArgumentNullException(nameof(parent));
@@ -519,7 +519,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
public IEnumerable<IContent> GetAncestors(int id)
{
// intentionnaly not locking
// intentionally not locking
var content = GetById(id);
return GetAncestors(content);
}
@@ -628,7 +628,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns>Parent <see cref="IContent"/> object</returns>
public IContent GetParent(int id)
{
// intentionnaly not locking
// intentionally not locking
var content = GetById(id);
return GetParent(content);
}
@@ -722,9 +722,9 @@ namespace Umbraco.Core.Services.Implement
}
/// <summary>
/// Checks if the passed in <see cref="IContent"/> can be published based on the anscestors publish state.
/// Checks if the passed in <see cref="IContent"/> can be published based on the ancestors publish state.
/// </summary>
/// <param name="content"><see cref="IContent"/> to check if anscestors are published</param>
/// <param name="content"><see cref="IContent"/> to check if ancestors are published</param>
/// <returns>True if the Content can be published, otherwise False</returns>
public bool IsPathPublishable(IContent content)
{
@@ -750,8 +750,6 @@ namespace Umbraco.Core.Services.Implement
#region Save, Publish, Unpublish
// fixme - kill all those raiseEvents
/// <inheritdoc />
public OperationResult Save(IContent content, int userId = 0, bool raiseEvents = true)
{
@@ -780,7 +778,7 @@ namespace Umbraco.Core.Services.Implement
var culturesChanging = content.ContentType.VariesByCulture()
? content.CultureInfos.Where(x => x.Value.IsDirty()).Select(x => x.Key).ToList()
: null;
//TODO: Currently there's no way to change track which variant properties have changed, we only have change
// TODO: Currently there's no way to change track which variant properties have changed, we only have change
// tracking enabled on all values on the Property which doesn't allow us to know which variants have changed.
// in this particular case, determining which cultures have changed works with the above with names since it will
// have always changed if it's been saved in the back office but that's not really fail safe.
@@ -877,7 +875,7 @@ namespace Umbraco.Core.Services.Implement
// if culture is specific, first publish the invariant values, then publish the culture itself.
// if culture is '*', then publish them all (including variants)
// explicitely SaveAndPublish a specific culture also publishes invariant values
// explicitly SaveAndPublish a specific culture also publishes invariant values
if (!culture.IsNullOrWhiteSpace() && culture != "*")
{
// publish the invariant values
@@ -1018,7 +1016,6 @@ namespace Umbraco.Core.Services.Implement
// keep going, though, as we want to save anyways
}
//fixme - casting
// reset published state from temp values (publishing, unpublishing) to original value
// (published, unpublished) in order to save the document, unchanged
((Content)content).Published = content.Published;
@@ -1042,7 +1039,6 @@ namespace Umbraco.Core.Services.Implement
unpublishResult = StrategyUnpublish(scope, content, userId, evtMsgs);
else
{
//fixme - casting
// reset published state from temp values (publishing, unpublishing) to original value
// (published, unpublished) in order to save the document, unchanged
((Content)content).Published = content.Published;
@@ -1116,7 +1112,7 @@ namespace Umbraco.Core.Services.Implement
}
// if was not published and now is... descendants that were 'published' (but
// had an unpublished ancestor) are 're-published' ie not explicitely published
// had an unpublished ancestor) are 're-published' ie not explicitly published
// but back as 'published' nevertheless
if (!branchOne && isNew == false && previouslyPublished == false && HasChildren(content.Id))
{
@@ -1414,8 +1410,6 @@ namespace Umbraco.Core.Services.Implement
{
scope.WriteLock(Constants.Locks.ContentTree);
// fixme events?!
if (!document.HasIdentity)
throw new InvalidOperationException("Cannot not branch-publish a new document.");
@@ -1568,8 +1562,7 @@ namespace Umbraco.Core.Services.Implement
DoDelete(content);
}
//TODO:
// both DeleteVersions methods below have an issue. Sort of. They do NOT take care of files the way
//TODO: both DeleteVersions methods below have an issue. Sort of. They do NOT take care of files the way
// Delete does - for a good reason: the file may be referenced by other, non-deleted, versions. BUT,
// if that's not the case, then the file will never be deleted, because when we delete the content,
// the version referencing the file will not be there anymore. SO, we can leak files.
@@ -1624,7 +1617,6 @@ namespace Umbraco.Core.Services.Implement
if (deletePriorVersions)
{
var content = GetVersion(versionId);
// fixme nesting uow?
DeleteVersions(id, content.UpdateDate, userId);
}
@@ -1810,7 +1802,6 @@ namespace Umbraco.Core.Services.Implement
private void PerformMoveContentLocked(IContent content, int userId, bool? trash)
{
//fixme no casting
if (trash.HasValue) ((ContentBase)content).Trashed = trash.Value;
content.WriterId = userId;
_documentRepository.Save(content);
@@ -1841,7 +1832,7 @@ namespace Umbraco.Core.Services.Implement
return OperationResult.Cancel(evtMsgs);
}
// emptying the recycle bin means deleting whetever is in there - do it properly!
// emptying the recycle bin means deleting whatever is in there - do it properly!
var query = Query<IContent>().Where(x => x.ParentId == Constants.System.RecycleBinContent);
var contents = _documentRepository.Get(query).ToArray();
foreach (var content in contents)
@@ -1991,8 +1982,8 @@ namespace Umbraco.Core.Services.Implement
/// Sends an <see cref="IContent"/> to Publication, which executes handlers and events for the 'Send to Publication' action.
/// </summary>
/// <param name="content">The <see cref="IContent"/> to send to publication</param>
/// <param name="userId">Optional Id of the User issueing the send to publication</param>
/// <returns>True if sending publication was succesfull otherwise false</returns>
/// <param name="userId">Optional Id of the User issuing the send to publication</param>
/// <returns>True if sending publication was successful otherwise false</returns>
public bool SendToPublication(IContent content, int userId = 0)
{
using (var scope = ScopeProvider.CreateScope())
@@ -2009,7 +2000,7 @@ namespace Umbraco.Core.Services.Implement
? string.Join(",", content.CultureInfos.Where(x => x.Value.IsDirty()).Select(x => x.Key))
: null;
//TODO: Currently there's no way to change track which variant properties have changed, we only have change
// TODO: Currently there's no way to change track which variant properties have changed, we only have change
// tracking enabled on all values on the Property which doesn't allow us to know which variants have changed.
// in this particular case, determining which cultures have changed works with the above with names since it will
// have always changed if it's been saved in the back office but that's not really fail safe.
@@ -2391,7 +2382,6 @@ namespace Umbraco.Core.Services.Implement
// ensure that the document has published values
// either because it is 'publishing' or because it already has a published version
//fixme - casting
if (((Content)content).PublishedState != PublishedState.Publishing && content.PublishedVersionId == 0)
{
Logger.Info<ContentService>("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document does not have published values");
@@ -2461,7 +2451,6 @@ namespace Umbraco.Core.Services.Implement
EventMessages evtMsgs)
{
// change state to publishing
// fixme - casting
((Content)content).PublishedState = PublishedState.Publishing;
//if this is a variant then we need to log which cultures have been published/unpublished and return an appropriate result
@@ -2541,7 +2530,6 @@ namespace Umbraco.Core.Services.Implement
Logger.Info<ContentService>("Document {ContentName} (id={ContentId}) had its release date removed, because it was unpublished.", content.Name, content.Id);
// change state to unpublishing
// fixme - casting
((Content)content).PublishedState = PublishedState.Unpublishing;
Logger.Info<ContentService>("Document {ContentName} (id={ContentId}) has been unpublished.", content.Name, content.Id);
@@ -2561,10 +2549,10 @@ namespace Umbraco.Core.Services.Implement
/// inheritance and compositions, which need to be managed outside of this method.</para>
/// </remarks>
/// <param name="contentTypeId">Id of the <see cref="IContentType"/></param>
/// <param name="userId">Optional Id of the user issueing the delete operation</param>
/// <param name="userId">Optional Id of the user issuing the delete operation</param>
public void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = 0)
{
//TODO: This currently this is called from the ContentTypeService but that needs to change,
// TODO: This currently this is called from the ContentTypeService but that needs to change,
// if we are deleting a content type, we should just delete the data and do this operation slightly differently.
// This method will recursively go lookup every content item, check if any of it's descendants are
// of a different type, move them to the recycle bin, then permanently delete the content items.