Skip to content

Commit

Permalink
fix: Article attachments lost when cancel the scheduling - MEED-8390 -
Browse files Browse the repository at this point in the history
…Meeds-io/meeds#2935 (#2450) (#2451)

Prior to this change, when canceling the scheduling of an article with attachments, the article's attachments were not linked to the newly created draft. This change ensures that the attachments from the deleted article are moved to the newly created draft.
  • Loading branch information
sofyenne authored Feb 13, 2025
1 parent 35cf195 commit f6666c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ export default {
});
},
beforeDestroy() {
document.removeEventListener('note-draft-auto-save-done');
document.removeEventListener('open-notes-attachments');
document.addEventListener('attachments-app-drawer-closed');
document.removeEventListener('open-notes-attachments', this.openAttachmentDrawer);
document.removeEventListener('attachments-app-drawer-closed', this.handleDrawerClosedEvent);
document.removeEventListener('article-draft-auto-save-done');
},
methods: {
openAttachmentDrawer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ public void onEvent(Event event) throws Exception {
String draftPageId = (String) data.get("draftPageId");
String pageVersionId = (String) data.get("pageVersionId");
String draftForExistingPageId = (String) data.get("draftForExistingPageId");
String unscheduledPageVersionId = (String) data.get("unscheduledPageVersionId");


if (draftPageId != null && pageVersionId != null) {
moveAttachments(draftPageId, pageVersionId, WIKI_DRAFT_PAGES, WIKI_PAGE_VERSIONS);
}

if (draftPageId != null && unscheduledPageVersionId != null) {
moveAttachments(unscheduledPageVersionId, draftPageId, WIKI_PAGE_VERSIONS ,WIKI_DRAFT_PAGES);
}

if (draftForExistingPageId != null && pageVersionId != null) {
copyAttachments(pageVersionId, draftForExistingPageId, WIKI_PAGE_VERSIONS, WIKI_DRAFT_PAGES);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
<set-method>addListener</set-method>
<type>org.exoplatform.services.attachments.listener.NoteAttachmentUpdateListener</type>
</component-plugin>
<component-plugin>
<name>note.draft.for.new.page.created</name>
<set-method>addListener</set-method>
<type>org.exoplatform.services.attachments.listener.NoteAttachmentUpdateListener</type>
</component-plugin>

</external-component-plugins>

Expand Down

0 comments on commit f6666c0

Please sign in to comment.