Commit 7d18c4d2 authored by Stan Hu's avatar Stan Hu

Truncate merge request titles with periods instead of ellipsis

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54862
parent acc785f5
...@@ -177,7 +177,9 @@ class Commit ...@@ -177,7 +177,9 @@ class Commit
def title def title
return full_title if full_title.length < 100 return full_title if full_title.length < 100
full_title.truncate(81, separator: ' ', omission: '…') # Use three dots instead of the ellipsis Unicode character because
# some clients show the raw Unicode value in the merge commit.
full_title.truncate(81, separator: ' ', omission: '...')
end end
# Returns the full commits title # Returns the full commits title
......
---
title: Truncate merge request titles with periods instead of ellipsis
merge_request: 23558
author:
type: changed
...@@ -204,7 +204,7 @@ describe Commit do ...@@ -204,7 +204,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('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis…') expect(commit.title).to eq('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id...')
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment