Merge pull request #268 from simi/show-committer-only-when-needed
Show committer only when needed.
This commit is contained in:
commit
ce6f609577
|
@ -26,3 +26,8 @@ require 'travis/model'
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
).property('message')
|
).property('message')
|
||||||
|
|
||||||
|
authorIsCommitter: ( ->
|
||||||
|
@get('authorName') == @get('committerName') and
|
||||||
|
@get('authorEmail') == @get('committerEmail')
|
||||||
|
).property('authorName', 'authorEmail', 'committerName', 'committerEmail')
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="author">
|
<div class="author">
|
||||||
{{#if commit.authorName}}
|
{{#if commit.authorName}}
|
||||||
<div class="authored"><img {{bind-attr src="view.urlAuthorGravatarImage"}}/>{{commit.authorName}} authored</div>
|
<div class="authored"><img {{bind-attr src="view.urlAuthorGravatarImage"}}/>{{commit.authorName}} authored{{#if commit.authorIsCommitter}} and committed{{/if}}</div>
|
||||||
{{/if}}
|
|
||||||
{{#if commit.committerName}}
|
|
||||||
<div class="committed"><img {{bind-attr src="view.urlCommitterGravatarImage"}}/>{{commit.committerName}} committed</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#unless commit.authorIsCommitter}}
|
||||||
|
{{#if commit.committerName}}
|
||||||
|
<div class="committed"><img {{bind-attr src="view.urlCommitterGravatarImage"}}/>{{commit.committerName}} committed</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="commit-changes">
|
<div class="commit-changes">
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
|
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>')
|
||||||
|
|
||||||
Travis.rootElement = '#ember-testing';
|
Travis.rootElement = '#ember-testing'
|
||||||
Travis.setupForTesting();
|
Travis.setupForTesting()
|
||||||
Travis.injectTestHelpers();
|
Travis.injectTestHelpers()
|
||||||
|
|
||||||
oldSetup = Travis.setup
|
oldSetup = Travis.setup
|
||||||
Travis.ready = ->
|
Travis.ready = ->
|
||||||
|
|
39
assets/scripts/spec/unit/commit_spec.coffee
Normal file
39
assets/scripts/spec/unit/commit_spec.coffee
Normal 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'))
|
Loading…
Reference in New Issue
Block a user