From 8e4dc038676fc650c19ec5ea11aaa2eaf5365fba Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 10 Jun 2015 12:53:59 -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 f8c41e1..71f41a4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@
 - Fix "Importing..." message does not hide on error (#1490422)
 - 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 2535c4c..9a73432 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