[Rt-commit] rt branch, 4.6/pjax, updated. rt-4.4.1-14-gfe79655

Shawn Moore shawn at bestpractical.com
Fri Nov 18 15:32:43 EST 2016


The branch, 4.6/pjax has been updated
       via  fe796556a8e2aa13b66762abe6946e48388b7a21 (commit)
       via  60ad9619ff4116a60a64ec0fd202ffb6ef786082 (commit)
      from  d6eadbe03788785d0f66a06ea1d6d12258cefa9e (commit)

Summary of changes:
 lib/RT/Dashboard/Mailer.pm | 1 +
 lib/RT/Interface/Web.pm    | 2 +-
 share/html/Elements/Header | 4 +++-
 3 files changed, 5 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 60ad9619ff4116a60a64ec0fd202ffb6ef786082
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Nov 18 20:27:00 2016 +0000

    Update page title on pjax requests
    
    According to
    https://github.com/defunkt/jquery-pjax/issues/382#issuecomment-56419750
    putting <title> into the response body is the recommended solution.

diff --git a/share/html/Elements/Header b/share/html/Elements/Header
index 3dfbeb0..7974836 100644
--- a/share/html/Elements/Header
+++ b/share/html/Elements/Header
@@ -45,7 +45,9 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-% unless ($IsPjaxRequest) {
+% if ($IsPjaxRequest) {
+<title><%$Title%></title>
+% } else {
 %# index.html gets two doctypes unless we can skip it here
 % unless ($SkipDoctype) {
 <!DOCTYPE html>

commit fe796556a8e2aa13b66762abe6946e48388b7a21
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Nov 18 20:30:04 2016 +0000

    Avoid PJAX's use of RequestENV during dashboard mailing
    
    $m->cgi_object is undef (due to dashboard mailer having faked out parts
    of Mason, so calling ->env on it throws an error when IsPjaxRequest
    tries to inspect RequestENV.
    
    The ideal solution would be to have dashboard mailing stop faking "just
    enough" of the Mason environment and use it in a more straightforward
    way, but that is a much more comprehensive change.

diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index f06c438..da3620c 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -313,6 +313,7 @@ SUMMARY
         return;
     }
 
+    local $HTML::Mason::Commands::FakeRequest = 1;
     local $HTML::Mason::Commands::session{CurrentUser} = $currentuser;
     local $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
 
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 4c23e46..eb61572 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -4438,7 +4438,7 @@ sub GetCustomFieldInputNamePrefix {
 }
 
 sub IsPjaxRequest {
-    return 0 if !RT->Config->Get('EnablePjax');
+    return 0 if !RT->Config->Get('EnablePjax') || $HTML::Mason::Commands::FakeRequest;
     RT::Interface::Web::RequestENV('HTTP_X_PJAX');
 }
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list