diff --git a/pgweb/lists/views.py b/pgweb/lists/views.py index bb8b445..5725c11 100644 --- a/pgweb/lists/views.py +++ b/pgweb/lists/views.py @@ -18,12 +18,21 @@ def subscribe(request): if form.is_valid(): mailtxt = "" if form.cleaned_data['action'] == 'subscribe': - mailtxt += "subscribe %s\n" % form.cleaned_data['lists'] mailsubject = "subscribe" - if not form.cleaned_data['receive']: - mailtxt += "set nomail\n" - if form.cleaned_data['digest']: - mailtxt += "set digest\n" + # Default is get mail and not digest, in which case we send a regular + # subscribe request. In other cases, we send subscribe-set which also + # sets those flags. + if form.cleaned_data['receive'] and not form.cleaned_data['digest']: + mailtxt += "subscribe %s\n" % form.cleaned_data['lists'] + else: + tags = [] + if not form.cleaned_data['receive']: + tags.append('nomail') + if form.cleaned_data['digest']: + tags.append('digest') + + mailtxt += "subscribe-set %s %s\n" % (form.cleaned_data['lists'], + ",".join(tags)) else: mailtxt += "unsubscribe %s\n" % form.cleaned_data['lists'] mailsubject = "unsubscribe"