XF 2.2 Insert new post before first in thread

hongtrang

Member
I change the order in which posts are displayed in a thread by extending the class:
PHP:
<?php
use XF\Mvc\Entity\Finder;
use XF\Mvc\Entity\Repository;

namespace HT\ForumImplement\Repository;

class Thread extends XFCP_Thread
{
    public function getDefaultPostListSortOptionsRd(): array
    {
        return [
        'post_date' => [
        ['position', 'DESC'],
        ['post_date', 'DESC'],
        ]
        ];
    }
}
The display of posts in threads has met my wishes
However, when the user submits the add-reply, the post is displayed under the lastpost. After reloading the page, it shows up again according to my wishes ( ['position', 'DESC'], ['post_date', 'DESC'] )

How do I Insert new post before first in thread without having to reload thread

Thanks!
 
I solved the problem by copy and editing the message.js file
JavaScript:
    // ################################## QUICK REPLY HANDLER ###########################################

    XF.QuickReply = XF.Element.newHandler({

        options: {
            messageContainer: '',
            ascending: false, //default is true
            submitHide: null
        },
 
Top Bottom