Merge branch 'emailsonpush-hellip' into 'master'

Don't use HTML ellipsis in EmailsOnPush subject truncated commit message.

Addresses private issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2229.

Since the page is encoded as UTF-8, we don't need HTML entities anymore and can just use the character.

See merge request !521
This commit is contained in:
Dmitriy Zaporozhets 2015-04-15 12:37:19 +00:00
commit 089f5b914e
3 changed files with 4 additions and 3 deletions

View file

@ -4,6 +4,7 @@ v 7.10.0 (unreleased)
- Allow users to be invited by email to join a group or project. - Allow users to be invited by email to join a group or project.
- Don't crash when project repository doesn't exist. - Don't crash when project repository doesn't exist.
- Add config var to block auto-created LDAP users. - Add config var to block auto-created LDAP users.
- Don't use HTML ellipsis in EmailsOnPush subject truncated commit message.
- Fix broken file browsing with a submodule that contains a relative link (Stan Hu) - Fix broken file browsing with a submodule that contains a relative link (Stan Hu)
- Fix persistent XSS vulnerability around profile website URLs. - Fix persistent XSS vulnerability around profile website URLs.
- Fix project import URL regex to prevent arbitary local repos from being imported. - Fix project import URL regex to prevent arbitary local repos from being imported.

View file

@ -77,7 +77,7 @@ class Commit
title_end = title.index("\n") title_end = title.index("\n")
if (!title_end && title.length > 100) || (title_end && title_end > 100) if (!title_end && title.length > 100) || (title_end && title_end > 100)
title[0..79] << "&hellip;".html_safe title[0..79] << ""
else else
title.split("\n", 2).first title.split("\n", 2).first
end end
@ -90,7 +90,7 @@ class Commit
title_end = safe_message.index("\n") title_end = safe_message.index("\n")
@description ||= @description ||=
if (!title_end && safe_message.length > 100) || (title_end && title_end > 100) if (!title_end && safe_message.length > 100) || (title_end && title_end > 100)
"&hellip;".html_safe << safe_message[80..-1] "" << safe_message[80..-1]
else else
safe_message.split("\n", 2)[1].try(:chomp) safe_message.split("\n", 2)[1].try(:chomp)
end end

View file

@ -14,7 +14,7 @@ describe Commit do
message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.' message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.'
allow(commit).to receive(:safe_message).and_return(message) allow(commit).to receive(:safe_message).and_return(message)
expect(commit.title).to eq("#{message[0..79]}&hellip;") expect(commit.title).to eq("#{message[0..79]}")
end end
it "truncates a message with a newline before 80 characters at the newline" do it "truncates a message with a newline before 80 characters at the newline" do