Use `Commit#short_id` instead of `Commit.truncate_sha`

parent 2eeeb266
......@@ -73,7 +73,7 @@ class Todo < ActiveRecord::Base
def to_reference
if for_commit?
Commit.truncate_sha(commit_id)
target.short_id
else
target.to_reference
end
......
......@@ -117,9 +117,11 @@ describe Todo, models: true do
describe '#to_reference' do
it 'returns the short commit id for commits' do
subject.project = project
subject.target_type = 'Commit'
subject.commit_id = commit.id
expect(subject.to_reference).to eq Commit.truncate_sha(commit.id)
expect(subject.to_reference).to eq commit.short_id
end
it 'returns reference for issuables' 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