summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-01-09 09:06:01 +0100
committerAleksander Machniak <alec@alec.pl>2015-01-09 09:06:01 +0100
commit9e26034801fe505a481d474e06bfc806cd548598 (patch)
tree39b902ffab97dda660b819a4bbe9a22df655dffd /program
parent788d37db0d6dbcb44f5de7b679418dfed8daf9d1 (diff)
Fix bug where max_group_members was ignored when adding a new contact (#1490214)
Also fix list refresh after new contact was added and any group is selected.
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js3
-rw-r--r--program/steps/addressbook/save.inc14
2 files changed, 11 insertions, 6 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 29a53bb26..c792bb64b 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4774,6 +4774,9 @@ function rcube_webmail()
if (!src)
src = this.env.source;
+ if (refresh)
+ group = this.env.group;
+
if (page && this.current_page == page && src == this.env.source && group == this.env.group)
return false;
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 4f30fd4b7..518625cb5 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -226,13 +226,15 @@ else {
$plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array(
'group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source));
- $counts = $CONTACTS->count();
-
if (!$plugin['abort']) {
- if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($counts->count + 1 > $maxnum))
- $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
-
- $CONTACTS->add_to_group($plugin['group_id'], $plugin['ids']);
+ if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum)) {
+ // @FIXME: should we remove the contact?
+ $msgtext = $RCMAIL->gettext(array('name' => 'maxgroupmembersreached', 'vars' => array('max' => $maxnum)));
+ $OUTPUT->command('parent.display_message', $msgtext, 'warning');
+ }
+ else {
+ $CONTACTS->add_to_group($plugin['group_id'], $plugin['ids']);
+ }
}
}