Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve Smith 75 posts 158 karma points
    Nov 28, 2017 @ 09:12
    Steve Smith
    1

    Content tree not fully updating after document move on publish

    Hi all,

    I have a project where members can submit potential news stories via the front-end of the site. The content they create is saved as an un-published "news" node which is filed in a "Pending" folder.

    The administrator then logs in to the Umbraco back office, reviews the articles in the "Pending" folder, before publishing them.

    On publish (using the ContentService.Publishing event handler), I move the story in to a month/year folder (so it becomes site.com/year/month/news-story).

    All is working fine, apart from one small point.

    When the administrator clicks on "Publish", the content tree updates to show the node in it's new location.

    However, it's still visible in the "Pending" folder until you reload the Content tab in the back office - as you can see here:

    enter image description here

    "Another test news story" has been moved to sit under it's 2017-11 folder structure, but remains visible under "Pending news".

    Any ideas?

    Steve.

  • Ben Palmer 180 posts 866 karma points c-trib
    Nov 28, 2017 @ 09:18
    Ben Palmer
    0

    Hi Steve,

    How are you moving the content on publish? Is it a manual job through the CMS? If so what are the exact steps that you're taking?

    If it's code, can you show us that instead please?

    Thanks!

  • Steve Smith 75 posts 158 karma points
    Nov 28, 2017 @ 09:39
    Steve Smith
    0

    Hello,

    I'm tapping in to the event handler ContentService.Publishing to move the node as part of the Publishing process.

    My code for this event handler looks at each node being published in a foreach loop, works out if they are already in the right place, or if they need moving. If they need moving, a check is made to see if the year/month nodes exist. If not, I create/publish the required nodes.

    Then finally when everything is set, I use...

    ApplicationContext.Current.Services.ContentService.Move(newsNode, monthNode.Id);
    

    ... to move the news node to sit under it's appropriate month node.

    As you can see from the screenshot, it's working fine - in that you can see the new "folder" nodes being created, and the news node being moved to the correct location. However, a duplicate copy (visually only) is remaining behind in it's old location.

    I also tried using...

    ClientTools clientTools = new ClientTools(new BasePage());
    clientTools.SyncTree(pendingFolder.Path, true);
    

    ... in an attempt to force a reload of the "Pending" folder, but that seems to not be happening.

    Steve.

  • Mladen B. 12 posts 35 karma points
    Dec 16, 2017 @ 18:49
    Mladen B.
    0

    I also need the solution to this situation.

  • Steve Smith 75 posts 158 karma points
    Dec 18, 2017 @ 10:46
    Steve Smith
    0

    I couldn't figure it out - and I started working on another project for a few weeks. Back on it today - will post if I find a workaround.

Please Sign in or register to post replies

Write your reply to:

Draft