0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Added default unsubscribe for single newsletter unsubscribe

refs https://github.com/TryGhost/Team/issues/1495
This commit is contained in:
Rishabh 2022-04-28 17:20:47 +05:30
parent 2ae8a5e14e
commit 7ca28de358

View file

@ -34,8 +34,15 @@ export default function UnsubscribePage() {
setMember(memberData);
setSubscribedNewsletters(memberData?.newsletters || []);
if (siteNewsletters?.length === 1) {
try {
await ghostApi.member.updateNewsletters({uuid: pageData.uuid, newsletters: []});
} catch (e) {
// ignore auto unsubscribe error
}
}
})();
}, [pageData.uuid, site.url]);
}, [pageData.uuid, site.url, siteNewsletters?.length]);
// Case: Email not found
if (member === null) {