Skip to content

Commit

Permalink
Fix subscription checkbox state on error in folder subscribe/unsubscr…
Browse files Browse the repository at this point in the history
…ibe action (#5243)
  • Loading branch information
alecpl committed Jun 8, 2016
1 parent f6861cc commit d0bb0a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ CHANGELOG Roundcube Webmail
- Fix handling of --delete argument in moduserprefs.sh script (#5296)
- Workaround PHP issue by calling closelog() on script shutdown when using log_driver=syslog (#5289)
- Fix so upgrade script makes sure program/lib directory does not contain old libraries (#5287)
- Fix subscription checkbox state on error in folder subscribe/unsubscribe action (#5243)

RELEASE 1.2.0
-------------
Expand Down
8 changes: 8 additions & 0 deletions program/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6900,6 +6900,14 @@ function rcube_webmail()
$('input[name="_subscribed[]"]:first', row).prop('disabled', true);
};

// resets state of subscription checkbox (e.g. on error)
this.reset_subscription = function(folder, state)
{
var row = this.subscription_list.get_item(folder, true);
if (row)
$('input[name="_subscribed[]"]:first', row).prop('checked', state);
};

this.folder_size = function(folder)
{
var lock = this.set_busy(true, 'loading');
Expand Down
12 changes: 9 additions & 3 deletions program/steps/settings/folders.inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ if ($RCMAIL->action == 'subscribe') {

$OUTPUT->show_message('foldersubscribed', 'confirmation');
}
else
else {
$RCMAIL->display_server_error('errorsaving');
$OUTPUT->command('reset_subscription', $mbox, false);
}
}
}
// unsubscribe mailbox
Expand All @@ -60,10 +62,14 @@ else if ($RCMAIL->action == 'unsubscribe') {

if (strlen($mbox)) {
$result = $STORAGE->unsubscribe(array($mbox));
if ($result)

if ($result) {
$OUTPUT->show_message('folderunsubscribed', 'confirmation');
else
}
else {
$RCMAIL->display_server_error('errorsaving');
$OUTPUT->command('reset_subscription', $mbox, true);
}
}
}
// delete an existing mailbox
Expand Down

0 comments on commit d0bb0a9

Please sign in to comment.