Open tammoterhark opened 5 years ago
I've had a look a tthis, the problem is that addBaseUrl
is a bit overzealous. These links are supposed to be href="#5b0d573837e4d" and refer to anchors inside the e-mail, but
addBaseUrl` instead lets them refer to the online page.
This is a bit of a challenge, since addBaseUrl
cannot really distinguish between links that are intended to self-reference the e-mail and links that are intended to refer to pages online. We could special-case anchor-only links (e.g. starting with #), but that does not feel so nice. A more elegant approach would be to explicitly opt-out these links by adding a class="no-base-url"
or something like that.
Currently, addBaseUrl
still uses regex-based replacement. For the above exception to be reliably implemented, this should be switched to an xpath-based implementation (#190). It would probably be good to change the mail-sending code (which now does dewikify_html and then addBaseUrl to convert the html string to a DomDocument node once, and then pass it to dewikify and (the rewritten) addBaseUrl, so the string -> node conversion only happens once. It might even be useful to change the sendMail
function to build up a complete DomDocument for the message body, rather than the string concatenation it does now. This would make it even easier to convert the string message to a node.
Whenever people change a page, certain users receive mails with notifications about which page was changed and a link to see the changes.
The link to the page is OK, but the link to the changes only shows the front page of the hypha instance.