Redirect to GET request after using the participant filter
authorMarcel Werk <burntime@woltlab.com>
Tue, 30 Mar 2021 17:11:03 +0000 (19:11 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 30 Mar 2021 17:11:03 +0000 (19:11 +0200)
files/lib/page/ConversationListPage.class.php

index 59f7eb5e2a1d6a7c26c1850e2948890850e01a4d..8dce6f794098bc2703f9621d232035147c76337a 100644 (file)
@@ -7,8 +7,10 @@ use wcf\system\clipboard\ClipboardHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\page\PageLocationManager;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\page\PageLocationManager;
+use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
+use wcf\util\HeaderUtil;
 
 /**
  * Shows a list of conversations.
 
 /**
  * Shows a list of conversations.
@@ -122,7 +124,7 @@ class ConversationListPage extends SortablePage {
                
                // labels
                $this->labelList = ConversationLabel::getLabelsByUser();
                
                // labels
                $this->labelList = ConversationLabel::getLabelsByUser();
-               if (isset($_REQUEST['labelID'])) {
+               if (!empty($_REQUEST['labelID'])) {
                        $this->labelID = intval($_REQUEST['labelID']);
                        
                        $validLabel = false;
                        $this->labelID = intval($_REQUEST['labelID']);
                        
                        $validLabel = false;
@@ -139,6 +141,20 @@ class ConversationListPage extends SortablePage {
                }
                
                if (isset($_REQUEST['participants'])) $this->participants = array_slice(ArrayUtil::trim(explode(',', $_REQUEST['participants'])), 0, 20);
                }
                
                if (isset($_REQUEST['participants'])) $this->participants = array_slice(ArrayUtil::trim(explode(',', $_REQUEST['participants'])), 0, 20);
+
+               if (!empty($_POST)) {
+                       $participantsParameter = '';
+                       foreach ($this->participants as $participant) {
+                               if (!empty($participantsParameter)) $participantsParameter .= ',';
+                               $participantsParameter .= \rawurlencode($participant);
+                       }
+                       if (!empty($participantsParameter)) {
+                               $participantsParameter = '&participants=' . $participantsParameter;
+                       }
+
+                       HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ConversationList', [], 'sortField='.$this->sortField.'&sortOrder='.$this->sortOrder.'&filter='.$this->filter.'&labelID='.$this->labelID.'&pageNo='.$this->pageNo.$participantsParameter));
+                       exit;
+               }
        }
        
        /** @noinspection PhpMissingParentCallCommonInspection */
        }
        
        /** @noinspection PhpMissingParentCallCommonInspection */