Skip to content

Commit a1cae3f

Browse files
sitereactornul800sebastiaan
authored andcommitted
Fixes U4-2731 Document.BeforeMove + Document.AfterMove Doesn't get fired.
Using the legacy Document and Media classes for the .Move and .Copy calls as they already use the new services under the hood, so shouldn't make any noticeable difference except that the legacy events will also work. Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
1 parent d22dbb4 commit a1cae3f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,15 @@ private void HandleDocumentMoveOrCopy()
272272
{
273273
if (CurrentApp == Constants.Applications.Content)
274274
{
275-
Services.ContentService.Move((IContent)currContent, Request.GetItemAs<int>("copyTo"), getUser().Id);
275+
//Backwards comp. change, so old events are fired #U4-2731
276+
var doc = new Document(currContent as IContent);
277+
doc.Move(Request.GetItemAs<int>("copyTo"));
276278
}
277279
else
278280
{
279-
Services.MediaService.Move((IMedia)currContent, Request.GetItemAs<int>("copyTo"), getUser().Id);
281+
//Backwards comp. change, so old events are fired #U4-2731
282+
var media = new umbraco.cms.businesslogic.media.Media(currContent as IMedia);
283+
media.Move(Request.GetItemAs<int>("copyTo"));
280284
library.ClearLibraryCacheForMedia(currContent.Id);
281285
}
282286

@@ -290,7 +294,9 @@ private void HandleDocumentMoveOrCopy()
290294
{
291295
//NOTE: We ONLY support Copy on content not media for some reason.
292296

293-
var newContent = Services.ContentService.Copy((IContent)currContent, Request.GetItemAs<int>("copyTo"), RelateDocuments.Checked, getUser().Id);
297+
//Backwards comp. change, so old events are fired #U4-2731
298+
var newContent = new Document(currContent as IContent);
299+
newContent.Copy(Request.GetItemAs<int>("copyTo"), getUser(), RelateDocuments.Checked);
294300

295301
feedback.Text = ui.Text("moveOrCopy", "copyDone", nodes, getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
296302
feedback.type = uicontrols.Feedback.feedbacktype.success;

0 commit comments

Comments
 (0)