mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-21 08:30:23 -07:00
Merge pull request #37 from Ionic/feature/rework-unsubscribe
Rework Unsubscribe header parsing
This commit is contained in:
commit
8b80fafaba
@ -379,12 +379,16 @@ class MailHops {
|
||||
}
|
||||
}
|
||||
if (header_unsubscribe) {
|
||||
var unsubscribeArr = header_unsubscribe.split(',');
|
||||
|
||||
for (var i = 0; i < unsubscribeArr.length; ++i) {
|
||||
auth.push({
|
||||
type: 'Unsubscribe',
|
||||
color: 'grey',
|
||||
link: header_unsubscribe.replace('<', '').replace('>', '').trim()
|
||||
link: unsubscribeArr[i].replace(/</, '').replace(/>/, '').trim()
|
||||
});
|
||||
}
|
||||
}
|
||||
return auth;
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,11 @@ function updateContent(msg, noauth) {
|
||||
}
|
||||
else if (msg.message.auth[a].link) {
|
||||
var add = '';
|
||||
|
||||
// We only check for a comma in case our base code failed to split
|
||||
// the header links up correctly.
|
||||
// Usually, it should work fine and add multiple buttons for
|
||||
// multiple links.
|
||||
if (-1 != msg.message.auth[a].link.indexOf(',')) {
|
||||
add = '<a class="tiny ui label ' + msg.message.auth[a].color + '" href="'+msg.message.auth[a].link.substr(0,msg.message.auth[a].link.indexOf(','))+'" target="_blank">' + msg.message.auth[a].type + '</a>';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user