Fix sorting conversations by username
authorMatthias Schmidt <gravatronics@live.com>
Mon, 5 Sep 2016 19:18:38 +0000 (21:18 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 5 Sep 2016 19:18:38 +0000 (21:18 +0200)
files/lib/page/ConversationListPage.class.php

index dbd2adb6cc54505ed1fc9d8c76f4500ad48167a5..a35f918ae326c9087cd399e7c8a76933fca77016 100644 (file)
@@ -144,8 +144,19 @@ class ConversationListPage extends SortablePage {
         * @see \wcf\page\IPage::readData()
         */
        public function readData() {
+               // if sort field is `username`, `conversation.` has to prepended because `username`
+               // alone is ambiguous 
+               if ($this->sortField === 'username') {
+                       $this->sortField = 'conversation.username';
+               }
+               
                parent::readData();
                
+               // change back to old value
+               if ($this->sortField === 'conversation.username') {
+                       $this->sortField = 'username';
+               }
+               
                if ($this->filter != '') {
                        // add breadcrumbs
                        WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));