From 43e9fc9499c54c7505acdcc780316fc54f037567 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 05 Jul 2014 08:01:36 -0400
Subject: [PATCH] Skip redundant get_group() call for better performance of listing groups in compose addressbook

---
 program/steps/mail/func.inc |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 5efafda..77f1172 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -2112,11 +2112,10 @@
     foreach ($abook->list_groups($search, $search_mode) as $group) {
         $abook->reset();
         $abook->set_group($group['ID']);
-        $group_prop = $abook->get_group($group['ID']);
 
         // group (distribution list) with email address(es)
-        if ($group_prop['email']) {
-            foreach ((array)$group_prop['email'] as $email) {
+        if ($group['email']) {
+            foreach ((array)$group['email'] as $email) {
                 $row_id = 'G'.$group['ID'];
                 $jsresult[$row_id] = format_email_recipient($email, $group['name']);
                 $OUTPUT->command('add_contact_row', $row_id, array(
@@ -2124,7 +2123,7 @@
             }
         }
         // make virtual groups clickable to list their members
-        else if ($group_prop['virtual']) {
+        else if ($group['virtual']) {
             $row_id = 'G'.$group['ID'];
             $OUTPUT->command('add_contact_row', $row_id, array(
                 'contactgroup' => html::a(array(

--
Gitblit v1.9.1