ryanb / letter_opener

Preview mail in the browser instead of sending.
MIT License
3.73k stars 237 forks source link

Do not auto_link with global matcher #86

Closed kmcphillips closed 10 years ago

kmcphillips commented 10 years ago

I have been trying to track down why all our plain text emails that have been opened in letter_opener seem to be missing their URLs.

It turns out that in some cases in our app the global regex matcher $& is nil. In fact all global regex values are nil in this specific context. I have been trying to isolate and reduce and test but with no luck. It's killing me to be honest.

Regardless, the use of globals should be discouraged. I've made a small change where the match data is passed explicitly into the block for gsub and used by name rather than with $&. Cool? I'm making the assumption there are others that might be having this specific and difficult to nail down problem.

nashby commented 10 years ago

@kmcphillips I pushed your first commit, thanks!

kmcphillips commented 10 years ago

Awesome! :+1:

You bumping a version and pushing it up to rubygems? Or should I point it to GitHub with the SHA in our Gemfile?

nashby commented 10 years ago

@kmcphillips yeah, you can use master for now. There is one open pull request that might be included in the next release so I want to wait a bit.

kmcphillips commented 10 years ago

Ok, I'll keep an eye on it.

nashby commented 10 years ago

@kmcphillips hey, I just released 1.2.0 version with awesome new styles from @gurgeous. Could you please test it and report back? Thanks!

kmcphillips commented 10 years ago

On it.

kmcphillips commented 10 years ago

Layout looks good. Works well.

We use letter_opener_web which leverages most of what letter_opener does, but provides it in a web interface rather than opening it automatically. Our project is big and launching all those emails is too intrusive.

This works with the web client, but the old layout was fluid. Since this one is fixed it doesn't scale perfectly. But that's an issue to report over there, not here.

Looks good: screen shot 2013-12-11 at 4 00 15 pm

With letter_opener_web: screen shot 2013-12-11 at 3 58 54 pm