Show committer in build header only when he's not author.

This commit is contained in:
Josef Šimánek 2014-05-09 03:30:10 +02:00
parent b8bd3b5fe8
commit 141619c3f5
3 changed files with 50 additions and 4 deletions

View File

@ -26,3 +26,8 @@ require 'travis/model'
else
""
).property('message')
authorIsCommitter: ( ->
@get('authorName') == @get('committerName') and
@get('authorEmail') == @get('committerEmail')
).property('authorName', 'authorEmail', 'committerName', 'committerEmail')

View File

@ -31,11 +31,13 @@
<div class="footer">
<div class="author">
{{#if commit.authorName}}
<div class="authored"><img {{bind-attr src="view.urlAuthorGravatarImage"}}/>{{commit.authorName}} authored</div>
{{/if}}
{{#if commit.committerName}}
<div class="committed"><img {{bind-attr src="view.urlCommitterGravatarImage"}}/>{{commit.committerName}} committed</div>
<div class="authored"><img {{bind-attr src="view.urlAuthorGravatarImage"}}/>{{commit.authorName}} authored{{#if commit.authorIsCommitter}} and committed{{/if}}</div>
{{/if}}
{{#unless commit.authorIsCommitter}}
{{#if commit.committerName}}
<div class="committed"><img {{bind-attr src="view.urlCommitterGravatarImage"}}/>{{commit.committerName}} committed</div>
{{/if}}
{{/unless}}
</div>
<div class="commit-changes">

View File

@ -0,0 +1,39 @@
record = null
module "Travis.Commit",
setup: ->
teardown: ->
Travis.Commit.resetData()
test 'it recognizes when author is committer', ->
Travis.Commit.load [
{
id: 1,
committer_name: 'Jimmy',
committer_email: 'jimmy@example.com',
author_name: 'Jimmy',
author_email: 'jimmy@example.com'
}
]
Ember.run ->
record = Travis.Commit.find 1
console.log(record.get('authorName'))
equal(true, record.get('authorIsCommitter'))
test 'it recognizes when author is not committer', ->
Travis.Commit.load [
{
id: 1,
committer_name: 'Jimmy',
committer_email: 'jimmy@example.com',
author_name: 'John',
author_email: 'john@example.com'
}
]
Ember.run ->
record = Travis.Commit.find 1
console.log(record.get('authorName'))
equal(false, record.get('authorIsCommitter'))