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,11 +379,15 @@ class MailHops {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (header_unsubscribe) {
|
if (header_unsubscribe) {
|
||||||
auth.push({
|
var unsubscribeArr = header_unsubscribe.split(',');
|
||||||
type: 'Unsubscribe',
|
|
||||||
color: 'grey',
|
for (var i = 0; i < unsubscribeArr.length; ++i) {
|
||||||
link: header_unsubscribe.replace('<', '').replace('>', '').trim()
|
auth.push({
|
||||||
});
|
type: 'Unsubscribe',
|
||||||
|
color: 'grey',
|
||||||
|
link: unsubscribeArr[i].replace(/</, '').replace(/>/, '').trim()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return auth;
|
return auth;
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,11 @@ function updateContent(msg, noauth) {
|
|||||||
}
|
}
|
||||||
else if (msg.message.auth[a].link) {
|
else if (msg.message.auth[a].link) {
|
||||||
var add = '';
|
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(',')) {
|
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>';
|
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