Is it possible to prevent automatic restore of draft content?

  • Affected Version
    WoltLab Suite 3.0

    See title.


    I think a lot of problems are caused by the default behaviour of automatically restoring draft content when re-opening a post window in which there was previously content.


    I would like to be able to make this a manual only feature, is that possible?

  • Are you talking about restoring from a saved history of edited posts. Because you can turn off saving history in the Admin CP

  • No, I’m talking about the post editor.


    More often than not it seems that the recovered text is a previously abandoned post (meaning I don't want to see it again).


    In case it isn't, the ability to restore it would be very nice, but manually, via a button labelled "Restore Draft" or something.


    It’s only become an issue worth raising now that we’re using the thread template plugin, because if there was previously saved text, it’s overwriting our template, making it worthless.

    Edited once, last by darjeeling: Numerous mistakes. Also, some clarification. ().

  • How are you creating those templates? I don't recall this to be a stock feature.

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

  • Yeah... then you should probably ask the author to fix this particular problem.


    Drafts can be disabled completely. But since this problem only happens in combination with a 3rd party plugin, I wouldn't count on WoltLab doing much about it. Drafts should be handled reasonably by that plugin. Best report it there.


    Sadly, this is likely not a small change to make. I am not certain whether or not its an easy change to disable drafts only in sub-boards where templates exist, but that might be worth investigating as a quick fix (this still needs custom code, though). Changing this to be manual opt-in will certainly involve monkey-patching the JS and there are some pitfalls to this approach.


    A cursory glance into the WSC/WBB JS files did not reveal a quick solution that only needs a few lines, but I hadn't have the time to research this very well, either.

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

  • Understand all that, thanks.


    It’s still an irritation even when not using the templates. I would switch it off, for sure, if I could. I don’t want content restoring unless I ask for it.


    I’m surprised there’s not a single function called PasteDraftContent() or something, which could be commented out in the editor framework. So it does everything else, it just doesn’t stuff the text in at the end.


    But, I’m “not constrained by actually knowing much about it” so I’m sure you’re more likely to be right than me ?

  • I’m surprised there’s not a single function called PasteDraftContent() or something, which could be commented out in the editor framework.

    i would not hack anything out the stock code because of a 3rd party mod not working proper. It could end up breaking your site when upgrading it or something. I would either disable drafts to get around it, why do you need drafts? Or do like the other person said and contact the mod author and tell him it needs fixing.

  • I have contacted the author already but like I say, it’s not just about the templates.


    Not sure about living without drafts! I’ll give it a go.


    Thanks for your inputs, appreciated.

  • Each to their own I guess. I have never really made use of the draft feature on any forum run having it there for using. So just wondered why you was so keen to keep using the draft feature for.

  • It’s because many a time I’ve been part way through composing a long message when it’s disappeared for one or other reason: power shutoff, PC crash, session times out, cat sits on your keyboard..... you get the idea.


    At times like that, I’m very glad of the Drafts system.


    But usually, the only time I’m aware of a draft is when I go to create a post in a forum and it’s already populated with some old crap from ages ago that I decided not to post, or something.

  • i would not hack anything out the stock code because of a 3rd party mod not working proper. It could end up breaking your site when upgrading it or something. I would either disable drafts to get around it, why do you need drafts? Or do like the other person said and contact the mod author and tell him it needs fixing.

    Monkey-patching means you would change he prototype of the object and replace the method with a dummy at runtime. That can be done as a plugin in a way that is compatible with upgrades (as long as WL does not change the name of the method, that is).

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy