mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
FIX: Autolinking in email formatter was broken
This commit is contained in:
parent
c2b769bd95
commit
0c3b049176
2 changed files with 14 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
||||||
class EmailCook
|
class EmailCook
|
||||||
|
|
||||||
def self.url_regexp
|
def self.url_regexp
|
||||||
/[^\>]*((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»\s]))/
|
/^((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(raw)
|
def initialize(raw)
|
||||||
|
|
13
spec/components/email_cook_spec.rb
Normal file
13
spec/components/email_cook_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'email_cook'
|
||||||
|
|
||||||
|
describe EmailCook do
|
||||||
|
|
||||||
|
it 'adds linebreaks' do
|
||||||
|
expect(EmailCook.new("hello\nworld\n").cook).to eq("hello\n<br>world\n<br>")
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'autolinks' do
|
||||||
|
expect(EmailCook.new("https://www.eviltrout.com").cook).to eq("<a href='https://www.eviltrout.com'>https://www.eviltrout.com</a><br>")
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue