From a274fb2e20215716389ec3709f0726b7002521f3 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 10 Apr 2012 03:02:45 -0400
Subject: [PATCH] - Fix so "Back" from compose/show doesn't reset search request (#1488238)

---
 CHANGELOG                      |    1 +
 program/steps/mail/compose.inc |    6 +++++-
 program/js/app.js              |    6 +++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 5006fe0..6417cc1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix so "Back" from compose/show doesn't reset search request (#1488238)
 - Add option to delete messages instead of moving to Trash when in Junk folder (#1486686)
 - Fix invisible cursor when replying to a html message (#1487073)
 - Reset IP stored in session when destroying session data (#1488056)
diff --git a/program/js/app.js b/program/js/app.js
index 30333d8..025a366 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -569,7 +569,8 @@
         break;
 
       case 'list':
-        this.reset_qsearch();
+        if (props && props != '')
+          this.reset_qsearch();
         if (this.task == 'mail') {
           this.list_mailbox(props);
           this.set_button_titles();
@@ -857,6 +858,9 @@
           url += '&_mbox='+urlencode(this.env.mailbox);
           if (props)
              url += '&_to='+urlencode(props);
+          // also send search request so we can go back to search result after message is sent
+          if (this.env.search_request)
+            url += '&_search='+this.env.search_request;
         }
         // modify url if we're in addressbook
         else if (this.task == 'addressbook') {
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 9475f34..ebf79be 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -118,7 +118,11 @@
   }
 
   // redirect to a unique URL with all parameters stored in session
-  $OUTPUT->redirect(array('_action' => 'compose', '_id' => $COMPOSE['id']));
+  $OUTPUT->redirect(array(
+    '_action' => 'compose',
+    '_id'     => $COMPOSE['id'],
+    '_search' => $_REQUEST['_search'],
+  ));
 }
 
 

--
Gitblit v1.9.1