From 47c83f4c496f9cb9b09cc25123b862f1402aacab Mon Sep 17 00:00:00 2001 From: Chimo Date: Sat, 6 Jun 2015 00:22:14 -0400 Subject: [PATCH] Only serve tagprofile HTML if we aren't POSTing via ajax This fixes an issue where POSTing the selftag form in the profile_block sidebar via AJAX would generate an XML response containing both the content from doPost() and showPage(), resulting in invalid XML. These changes make it so that if we're POSTing via AJAX, we serve content from doPost(), otherwise we serve showPage() but never both. --- actions/tagprofile.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/actions/tagprofile.php b/actions/tagprofile.php index 47a66d0be4..871d0e30b0 100644 --- a/actions/tagprofile.php +++ b/actions/tagprofile.php @@ -65,6 +65,15 @@ class TagprofileAction extends FormAction return sprintf(_m('ADDTOLIST','List %s'), $this->target->getNickname()); } + function showPage() + { + // Only serve page content if we aren't POSTing via ajax + // otherwise, we serve XML content from doPost() + if (!$this->isPost() || !$this->boolean('ajax')) { + parent::showPage(); + } + } + function showContent() { $this->elementStart('div', 'entity_profile h-card');