Previous fix didn't work if you don't Save() the document +don't publish copies.

This commit is contained in:
Sebastiaan Janssen
2012-12-27 16:08:24 -01:00
parent 140c1db66a
commit e10cb56502
2 changed files with 7 additions and 2 deletions

View File

@@ -976,10 +976,14 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional Id of the User copying the Content</param>
/// <returns>The newly created <see cref="IContent"/> object</returns>
public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1)
{
{
var copy = ((Content)content).Clone();
copy.ParentId = parentId;
// A copy should never be set to published
// automatically even if the original was
this.UnPublish(copy);
if (Copying.IsRaisedEventCancelled(new CopyEventArgs<IContent>(content, copy, parentId), this))
return null;
@@ -987,7 +991,7 @@ namespace Umbraco.Core.Services
using (var repository = _repositoryFactory.CreateContentRepository(uow))
{
SetWriter(content, userId);
repository.AddOrUpdate(copy);
uow.Commit();

View File

@@ -67,6 +67,7 @@ namespace umbraco.ActionHandlers
LogHelper.Debug<umbEnsureUniqueName>("Title changed from '" + documentObject.Text + "' to '" + currentName + "' for document id" + documentObject.Id);
documentObject.Text = currentName;
documentObject.Save();
return true;
}