From 8cab554252d2745b24a3fb6fc0fecc6f8086df1b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 10 Jun 2015 12:54:26 -0400
Subject: [PATCH] Fix unintentional messages list page change on page switch in compose addressbook (#1490427)

---
 CHANGELOG                   |    1 +
 program/steps/mail/func.inc |   11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index cd6369c..f2322f4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@
 - Update to jQuery 2.1.4 (#1490406)
 - Fix Compose action in addressbook for results from multiple addressbooks (#1490413)
 - Fix bug where some messages in multi-folder search couldn't be opened (#1490426)
+- Fix unintentional messages list page change on page switch in compose addressbook (#1490427)
 
 RELEASE 1.1.2
 -------------
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 684cdf9..f4d2675 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -161,12 +161,17 @@
     if (!strlen($mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true))) {
         $mbox = strlen($_SESSION['mbox']) ? $_SESSION['mbox'] : 'INBOX';
     }
-    if (!($page = intval($_GET['_page']))) {
-        $page = $_SESSION['page'] ? $_SESSION['page'] : 1;
+
+    if ($RCMAIL->action == 'list') {
+        if (!($page = intval($_GET['_page']))) {
+            $page = $_SESSION['page'] ? $_SESSION['page'] : 1;
+        }
+
+        $_SESSION['page'] = $page;
     }
 
     $RCMAIL->storage->set_folder($_SESSION['mbox'] = $mbox);
-    $RCMAIL->storage->set_page($_SESSION['page'] = $page);
+    $RCMAIL->storage->set_page($_SESSION['page']);
 
     // set default sort col/order to session
     if (!isset($_SESSION['sort_col'])) {

--
Gitblit v1.9.1