Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Post Edit History

edited December 2006 in Vanilla 1.0 Help
I'd like to see an Add-on that can save and recall the edit history of a comment. The ability to recall history would be tied to a preference in the role of the user (like "Can't Sign In" or "Show All Whispers" etc). All users would have comment histories saved. I can't start working on it myself yet, as I'm going to be flailing with converting punbb -> vanilla (damn you MD5/SHA1!) -- but if no one else jumps on it, I certainly will :)
«1

Comments

  • Status:
    - Got the roles permission working (with a few stumbles).
    - Got a link inserted into the comment of each discussion (like, "quote" or "edit") when a user has permission to view the history.)
    - Got the "PostBackAction" page hooked so that I can display the relevant history status

    Next steps:
    - auto database table creation
    - hooking the edit process to store the old revision before it is overwritten
    - only displaying the "history" link when there *is* history (or, perhaps, change it's style accordingly)

    I've found examples on how to do the database auto-creation (yay code swiping from other extensions for learning!) but I'm a little lost on how to hook into the editing process. If you have any pointers here, I'd really dig hearing them. Thanks.
  • To hook into the editing process I suspect you need to find the function[s] which edits a post and see if there are the necessary delegates in place for you to hook into. If not I suggest you put a kind request in Marks direction once you've worked out what you need where :)
  • Rgr that -- I figured I was in for some digging :Ddebug_backtrace be praised...
  • Take a look at the PreSaveComment hook in library/Vanilla/Vanilla.Control.DiscussionForm.php. I think that'll provide what you need.

    Cool extension!
  • Progress!

    Wow, I feel like a blind man walking through a crystal vase shop coding through this. So new, so different -- gone are the days of direct & dirty sql punbb queries ;D

    Anyway, I got finished with:
    - database auto-initializing
    - hooking, snaging and storing the comment edits
    - displaying that a comment has edits, and thus a history
    - display the edits (nicely!) on the follow up edit page
    - nice ways of erroring out for now history/lacking permissions

    TODO:
    - I missed the hook for when and edit happens to a 'starter' comment (I think I saw this as PreSaveDiscussion right above the other hook, but I'm tired now...)
    - The edit page needs to link to the profile for the person who did the editing (at the least, their name and not id)
    - - This will be acomplished when I have slept and can get the sqlbuilder to do my join like bidding, no biggie
    - Not much else. :D

    I should have this done tomorrow (friday for me) -- any one care to be my guinea pig for some testing?

    Oh, and to entice you, here's some eye candy:

    History links, striken and all
    edit history buttons showing

    History page, all purdy
    edit history page in all it's simple glory
  • this feature was provided by jotspot. their forum has revision history. neat idea. but what the practicality of this. we hardly ever edit over comments, and even if we do, it usually spelling mistakes etc
  • edited December 2006
    It's not for users, it's for moderators. (In fact, the user doesn't even get to see the history -- just groups assigned the privilege)

    Along the same lines as never truly deleting comments, I also hate losing the history of what was said by a user. This comes in very, VERY handy when moderators/admins have to deal with lame users linking to inappropriate places, spouting off, or generally incriminating themselves -- we can instantly edit out what the moron left, but still retain a record of what was done for reference.

    Additionally, there's very little way to otherwise tell if a person edited for spelling vs. edited to remove something damning.

    But hey, it's a completely transparent extension -- don't want it? Don't use it. If you need it, you'll be glad it's around ;D
  • Just one thing, which appears not to currently happen (unless your 2 screenshots are from different things) - could you put the existing comment up top there? So people know what it says now?
    Also some people may like to view them chronologically going down instead of up as with comments in discussions...thats a personal thing though.
  • have u made punbb extensions. If yes then how do u compare Vanilla API with that of Punbb
  • Will this extension allow a user to revert back to a saved edit?
  • Nice idea as an option garvin :)
  • @MySchizoBuddy: punbb API? It has no api, silly ;) You just hack into the core files with patches. The typical pain.

    @Minisweeper: Yeah, I can put the current comment at the chronologically correct spot. I'll look into how to have an option to switch between asc/desc ordering. Perhaps as a per-user option.

    @garvin: no, the intention isn't really for versioning, so much as it is for historical records. I suppose you could allow members to view the history edits, thus allowing them to see what's changed and copy/paste back to an older version.
  • FUCK. SBC, YOU PRICKS.


    Sorry, random f'ing internet failure. I had this whole nice long post written up, so now you just get images:

    ------------------------------------------------------------

    ------------------------------------------------------------

    ------------------------------------------------------------

    ------------------------------------------------------------

    ------------------------------------------------------------

    And a download link: EditHistory v0.1.0

    Standard feedback is appreciated, but I'm also interested in knowing how well the code is executed. Tips on flow, shortcuts, methodology, etc would be well received in this area as well.
  • I know your original intention was not to attach "versioning" to it, but could that be done with the same extension?
  • In what way? Technically, this is versioning. Rudimentary, but true enough.
  • Note to self: escape DB input for edits. (Funny, I would have thought that the SqlBuilder class would have handled making sure input was escaped...)
  • edits? Dont the text formatters handle that?
  • Another note: Showing the IP of the computer that did the editing may be useful.
  • @Mini: I mean I need to escape the insert for saving the previous history or it can cause an error.

    @Wall: Excellent idea
  • Another note: and the username, since it doesnt have to be the original poster. And only show the IP if it's allowed.
This discussion has been closed.