Closed (fixed)
Project:
Subscriptions
Version:
6.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Mar 2012 at 01:17 UTC
Updated:
25 Mar 2012 at 22:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
salvisWhere do you set that preference? What else is needed to send out HTML notifications?
Would you like to post a patch? Since this is subscriptions_content.module, the checkbox should go into the Content Settings fieldset, just above "Generate the !full_node variable."
Comment #2
gregarios commentedMy mistake... the allowance of HTML is done in the Mime Mail module when used with Subscriptions — except that Subscriptions strips it's own HTML out of the node body. I just need to have a preference allowing the node body to have HTML in it, by disabling that one line of code.
I will see if I can write a patch to accomplish this in the next week or so. Shall I work off of 6.x-1.x-dev or 6.x.1.4?
Comment #3
gregarios commentedAttached is the patch. Please put it up in a new 1.5 release of you could. Thank you Salvis! :-)
(This is rolled on the 6.x-1.x-dev version)
Comment #4
gregarios commentedComment #5
gregarios commentedAttached is an even BETTER patch, which includes the changes my patch in #3 does, plus adds another much needed addition to your module... the ability to have an external mail template sourced from the Theme directory.
My addition just looks in the theme directory for a copy of the
subscriptions_mail.templates.incfile and uses it if it exists, instead of the one in the modules directory.Please take a look at this patch, and use it in a 1.5 release if you could. Thanks Salvis.
This patch is rolled in 6.x-1.x-dev and will finally free my customizations from the module directory completely! (if you release it) :-)
(I've fully tested this on my production site: www.kpbj.com)
Comment #6
salvisYes, always against the -dev version.
This looks good, except we need to pass it through the filter of the node.
(Just mark it NR.)
Comment #7
gregarios commentedUmmm... huh? :-)
Comment #8
salvisWhen you create a node, you select a filter (possibly by default), "Full HTML" for example. This filter needs to be applied when you render a node, whether to the browser or to an HTML mail message.
Comment #9
gregarios commentedThe filter already applies since the node is created before the subscription gets created, right? How in the world would my changes have disrupted that at all, since it is functioning exactly as before except for the location of the template file and the removal of the one line of code that strips-out the html (that the node filter already allowed to be there)?
Comment #10
gregarios commentedWait... I think I might see what you mean. However, I have no idea how to accomplish this, and actually would prefer it if my filters were not applied to the node body for emails...
Comment #11
salvisStripping out the HTML is the ultimate filter. Removing that leaves us without any filter, I think.
Filters are applied on output, not on input.
Comment #12
salvisSending unfiltered HTML would expose your email recipients to all sorts of attacks.
Why would you want to not apply any filter?
Comment #13
gregarios commentedYes. No filter at all is what I would like -- just the raw node body that was created without any post-processing. Many of the post-processing filters would never work in an email anyway, like Lightbox, curly-quotes, etc, etc... We could just leave a disclaimer on the checkbox... there's no way to do every node filter possibility even if we tried, but at least this allows SOME raw HTML though so images and links will work.
Comment #14
gregarios commentedHow would raw HTML in an email, that already exists in the website, make someone open to attack? The worst it would do is email everyone raw HTML, and plain old HTML with no Javascript or anything is never a security risk is it?
Comment #15
salvisWe need to filter not to add effects, but to remove hazardous HTML, as as when we render the node to the browser.
You want your email to look the same as in the browser, and the closest we can get is to apply the same filter.
Comment #16
gregarios commentedHow can this be done? Is it difficult?
Comment #17
salvisRemoving JavaScript is one of the things that filtering does. No filter => all scripting, embedded objects, iframes, etc. are delivered to the email recipient!
Comment #18
gregarios commentedOr, maybe instead of just removing all HTML, we could customize a filter of our own that specifically allows all "p", "a" and "img" tags, etc?
Comment #19
salvisOh, actually, we're doing that already with check_markup(). Sorry, my bad...
Comment #20
salvisComment #21
salvisOh, I hadn't actually seen your #5 when I posted what became my #6.
Let's fix one issue at a time. In this thread we'll "Add Preference to allow simple HTML through on nodes."
The other code is inacceptable as it is because of duplication and broken indenting.
Comment #22
salvisAlso, the order in hook_uninstall() should be alphabetical.
Comment #23
gregarios commentedLOL really?
I'm not sure what you mean -- you mean the code syntax indenting? I wasn't sure how to make it not duplicate... can you help me out with this? Do I make a function containing this:
Comment #24
gregarios commentedOk ok ok... new patch. See if you like it. I think it addresses your issues. :)
Indented correctly? Check.
Duplications rewritten? Check.
hook_uninstall() alphabetical? Check.
README updated? Check.
Tested on production site? Check.
Comment #25
salvisNo. Stop, please.
This issue is about "Add Preference to allow simple HTML through on nodes." and we will not do anything here but "Add Preference to allow simple HTML through on nodes." I should not have started talking about the additional stuff in #5, because I will definitely not commit a grab bag of stuff.
Anything that is not "Add Preference to allow simple HTML through on nodes." will need to go into a new issue.
Repost #3, but put the variable_del() in the correct place. If you find a sorted list somewhere, why would you put your new item into a random spot? Do you enjoy creating chaos?
Comment #26
gregarios commentedNew patch. See attached...
By the way, just because someone doesn't organize the way you do doesn't mean they "enjoy creating chaos." I happened to have purposefully put the
variable_del('subscriptions_allow_html_node_output');code next to the other variable deletion referencing the "node" portion of the process. I figured that the database could care less the way it was organized, so I apparently made the wrong choice. Sorry. :-/Comment #27
salvisPushed to the -dev version (give it up to 12h to be repackaged).
Thank you for your patch and your patience.
I've adjusted the description to try to minimize the potential support load caused by this new checkbox.
For the record: This is a D6-only patch. It does not apply to D7, because under D7 we always pass HTML to drupal_mail() and the mailsystem determines how to handle the rest.
I did consider the possibility that you hadn't noticed the alphabetical arrangement. However, your reply...
... seems to indicate that you don't think it's worth preserving. But if there is a structure in pre-existing code, then you need a pretty good reason for breaking it.
Comment #28
gregarios commentedThank you Salvis. I honestly hadn't noticed the alphabetization at all until you mentioned it.
Comment #29.0
(not verified) commentedadded some formatting...