[pmg-devel] [PATCH pmg-gui] fix broken maillist when deleting last mail in list

Stoiko Ivanov s.ivanov at proxmox.com
Wed Nov 13 21:18:07 CET 2019


On Mon, Nov 11, 2019 at 10:16:35AM +0100, Dominik Csapak wrote:
> on deleting the last mail in the list, the selection is empty and
> the access below to 'rec.data.id' breaks, leaving the maillist broken
> (until the user changed the panel or reloaded)
> 
> so give rec an empty fallback object and check if there is a 'data'
> property and use that, otherwise set the id to the empty string
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
* reproduced the issue locally with the latest master
* installed a version with the patch applied
* the issue went away

Tested-By: Stoiko Ivanov <s.ivanov at proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov at proxmox.com>

> ---
>  js/SpamQuarantine.js | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js
> index 7a3018b..79b0c59 100644
> --- a/js/SpamQuarantine.js
> +++ b/js/SpamQuarantine.js
> @@ -154,9 +154,10 @@ Ext.define('PMG.SpamQuarantine', {
>  		me.multiSelect();
>  		return;
>  	    }
> -	    var rec = selection[0];
>  
> -	    me.getViewModel().set('mailid', rec.data.id);
> +	    var rec = selection[0] || {};
> +
> +	    me.getViewModel().set('mailid', rec.data ? rec.data.id : '');
>  	    me.updatePreview(me.raw || false, rec);
>  	    me.lookupReference('spaminfo').setID(rec);
>  	},
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pmg-devel mailing list
> pmg-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
> 



More information about the pmg-devel mailing list