Compare commits

...

1 Commits

Author SHA1 Message Date
Shannon 17d4258507 U4-9912 Previewing without changing creates new version 2017-05-15 16:25:32 +10:00
2 changed files with 25 additions and 18 deletions
+6 -2
View File
@@ -2225,6 +2225,8 @@ namespace Umbraco.Core.Services
using (new WriteLock(Locker))
{
var currVersion = content.Version;
var uow = UowProvider.GetUnitOfWork();
using (var repository = RepositoryFactory.CreateContentRepository(uow))
{
@@ -2250,8 +2252,10 @@ namespace Umbraco.Core.Services
Saved.RaiseEvent(new SaveEventArgs<IContent>(content, false, evtMsgs), this);
Audit(AuditType.Save, "Save Content performed by user", userId, content.Id);
return OperationStatus.Success(evtMsgs);
return currVersion == content.Version
? OperationStatus.NoOperation(evtMsgs)
: OperationStatus.Success(evtMsgs);
}
}
+19 -16
View File
@@ -295,7 +295,8 @@ namespace Umbraco.Web.Editors
//initialize this to successful
var publishStatus = Attempt<PublishStatus>.Succeed();
var wasCancelled = false;
var wasCancelled = false; //tracks if the operation was cancelled
var noop = false; //tracks if the operation performed no operation (nothing to save)
if (contentItem.Action == ContentSaveAction.Save || contentItem.Action == ContentSaveAction.SaveNew)
{
@@ -303,6 +304,8 @@ namespace Umbraco.Web.Editors
var saveResult = Services.ContentService.WithResult().Save(contentItem.PersistedContent, Security.CurrentUser.Id);
wasCancelled = saveResult.Success == false && saveResult.Result.StatusType == OperationStatusType.FailedCancelledByEvent;
noop = saveResult.Result.StatusType == OperationStatusType.NoOperation;
}
else if (contentItem.Action == ContentSaveAction.SendPublish || contentItem.Action == ContentSaveAction.SendPublishNew)
{
@@ -313,7 +316,7 @@ namespace Umbraco.Web.Editors
{
//publish the item and check if it worked, if not we will show a diff msg below
publishStatus = Services.ContentService.SaveAndPublishWithStatus(contentItem.PersistedContent, Security.CurrentUser.Id);
wasCancelled = publishStatus.Result.StatusType == PublishStatusType.FailedCancelledByEvent;
wasCancelled = publishStatus.Result.StatusType == PublishStatusType.FailedCancelledByEvent;
}
//return the updated model
@@ -327,28 +330,28 @@ namespace Umbraco.Web.Editors
{
case ContentSaveAction.Save:
case ContentSaveAction.SaveNew:
if (wasCancelled == false)
{
display.AddSuccessNotification(
Services.TextService.Localize("speechBubbles/editContentSavedHeader"),
Services.TextService.Localize("speechBubbles/editContentSavedText"));
}
else
if (wasCancelled)
{
AddCancelMessage(display);
}
else if (noop == false)
{
display.AddSuccessNotification(
Services.TextService.Localize("speechBubbles/editContentSavedHeader"),
Services.TextService.Localize("speechBubbles/editContentSavedText"));
}
break;
case ContentSaveAction.SendPublish:
case ContentSaveAction.SendPublishNew:
if (wasCancelled == false)
{
display.AddSuccessNotification(
Services.TextService.Localize("speechBubbles/editContentSendToPublish"),
Services.TextService.Localize("speechBubbles/editContentSendToPublishText"));
}
else
if (wasCancelled)
{
AddCancelMessage(display);
}
else if (noop == false)
{
display.AddSuccessNotification(
Services.TextService.Localize("speechBubbles/editContentSendToPublish"),
Services.TextService.Localize("speechBubbles/editContentSendToPublishText"));
}
break;
case ContentSaveAction.Publish: