1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest XenForo_EditHistoryHandler_Post

Discussion in 'Closed Suggestions' started by xf_phantom, Jul 9, 2013.

  1. xf_phantom

    xf_phantom Well-Known Member

    Wouldn't it make sense to move the content of XenForo_EditHistoryHandler_Post::revertToVersion to a new abstract method in the XenForo_EditHistoryHandler_Abstract and have only the the datawriter as variable?

    I'm asking because this method can be used for ALL content types which are using the XenForo_DataWriter_DiscussionMessage_Abstract class.
    The only difference is the message datawriter name.

    Just to be sure you know what i mean:
    public function revertToVersion(array $content$revertCount, array $history, array $previous null)
    $dw XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post'XenForo_DataWriter::ERROR_SILENT);
    $dw->setOption(XenForo_DataWriter_DiscussionMessage::OPTION_EDIT_DATE_DELAY, -1);
    $dw->set('edit_count'$dw->get('edit_count') + 1);
         if (
           if (!
    $previous || $previous['edit_user_id'] != $content['user_id'])
    // if previous is a mod edit, don't show as it may have been hidden
           else if (
    $previous && $previous['edit_user_id'] == $content['user_id'])


    or another (probably better solution) =>

    A new abstract XenForo_EditHistoryHandler_Message class (like the DiscussionMessage Datawriter) which
    includes a new abstract method getMessageDataWriter and which also implements already
    • revertToVersion (as i said, only the dw is dynamic)
    • getText (it's "always" the message key if XenForo_DataWriter_DiscussionMessage is being used
    • formatHistory

    This would reduce the necessary code:)

Share This Page