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 533af87 commit 92df79b
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 @@ -18,6 +18,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 @@ -6856,6 +6856,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 92df79b

Please sign in to comment.