diff --git a/app/components/user-avatar.js b/app/components/user-avatar.js
index 4013db9f..2c2efde2 100644
--- a/app/components/user-avatar.js
+++ b/app/components/user-avatar.js
@@ -7,25 +7,8 @@ export default Ember.Component.extend({
tagName: 'span',
classNames: ['avatar'],
- gravatarUrl: function() {
- if (!this.get('isAuthor') && !this.get('isComitter')) {
- if (this.get('user.type') === 'organization') {
- return this.get('user.avatarUrl');
- } else {
- return gravatarImage(this.get('user.email'), 36);
- }
- } else {
- if (this.get('isAuthor')) {
- return this.user.get('authorAvatarUrlOrGravatar');
- } else if (this.get('isCommitter')) {
- return this.user.get('committerAvatarUrlorGravatar');
- }
- }
- }.property('gravatarUrl'),
-
userInitials: function() {
- var name = this.get('user.name') || this.get('user.login') ||
- this.get('user.authorName') || this.get('user.committerName');
+ var name = this.get('name');
var arr = name.split(' ');
var initials;
diff --git a/app/templates/components/build-header.hbs b/app/templates/components/build-header.hbs
index d03f3f99..9be21c8b 100644
--- a/app/templates/components/build-header.hbs
+++ b/app/templates/components/build-header.hbs
@@ -38,12 +38,12 @@
{{#if commit.authorName}}
- {{user-avatar user=commit isAuthor=true}}
+ {{user-avatar url=commit.authorAvatarUrlOrGravatar name=commit.authorName}}
{{commit.authorName}} authored{{#if commit.authorIsCommitter}} and committed{{/if}}
{{/if}}
{{#unless commit.authorIsCommitter}}
{{#if commit.committerName}}
- {{user-avatar user=commit isComitter=true}}
+ {{user-avatar url=commit.committerAvatarUrlOrGravatar name=commit.committerName}}
{{commit.committerName}} committed
{{/if}}
{{/unless}}
diff --git a/app/templates/components/builds-item.hbs b/app/templates/components/builds-item.hbs
index 7e38b4d5..9af01af9 100644
--- a/app/templates/components/builds-item.hbs
+++ b/app/templates/components/builds-item.hbs
@@ -20,7 +20,7 @@
{{/unless}}
- {{user-avatar user=build.commit isAuthor=true}}
+ {{user-avatar url=build.commit.authorAvatarUrlOrGravatar name=build.commit.authorName}}
{{build.commit.authorName}}
diff --git a/app/templates/components/org-item.hbs b/app/templates/components/org-item.hbs
index 4aba50c0..73fd8a87 100644
--- a/app/templates/components/org-item.hbs
+++ b/app/templates/components/org-item.hbs
@@ -1,5 +1,5 @@
- {{user-avatar user=account}}
+ {{user-avatar url=account.avatarUrl name=name}}
{{#link-to "account" account.login}}
diff --git a/app/templates/components/user-avatar.hbs b/app/templates/components/user-avatar.hbs
index 77a3a0f9..ce49589c 100644
--- a/app/templates/components/user-avatar.hbs
+++ b/app/templates/components/user-avatar.hbs
@@ -1,2 +1,4 @@
-

+{{#if url}}
+

+{{/if}}
diff --git a/app/templates/top.hbs b/app/templates/top.hbs
index 87a6e78f..c5df2481 100644
--- a/app/templates/top.hbs
+++ b/app/templates/top.hbs
@@ -58,7 +58,7 @@
{{#if auth.signedIn}}
{{#link-to "profile" class="navigation-anchor signed-in"}}
{{userName}}
- {{user-avatar user=user}}
+ {{user-avatar url=user.avatarUrl name=user.fullName}}
{{/link-to}}
{{/if}}
{{#if auth.signingIn}}
diff --git a/tests/unit/components/user-avatar-test.js b/tests/unit/components/user-avatar-test.js
index 06ca4396..bd575f34 100644
--- a/tests/unit/components/user-avatar-test.js
+++ b/tests/unit/components/user-avatar-test.js
@@ -7,55 +7,15 @@ moduleForComponent('user-avatar', 'UserAvatarComponent | Unit', {
});
test('it renders', function() {
- // Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.on('myAction', function(val) { ... });"
- var attributes = {
- type: 'organization',
- login: 'testuser',
- name: 'Test User',
- avatarUrl: 'https://0.gravatar.com/avatar/595cf623f3cde2fa64fc784884c4bfec'
- };
+ var name = "Hello Test";
+ var url = "https://someurl.com/someimage.jpg";
- var org = Ember.Object.create(attributes);
- var component = this.subject({user: org});
+ var component = this.subject({url: url, name: name});
this.append();
ok(component.$().hasClass('avatar'), 'component should have right class');
- equal(component.$('.pseudo-avatar').data('initials'), 'TU', 'initials should be correct');
- equal(component.$('.real-avatar').attr('src'), 'https://0.gravatar.com/avatar/595cf623f3cde2fa64fc784884c4bfec', 'avatar shoudl be right');
-
-});
-
-test('it handles a missing user name', function() {
-
- var attr = {
- type: 'organization',
- login: 'testorg'
- };
-
- var org = Ember.Object.create(attr);
- var component = this.subject({user: org});
- this.append();
-
- equal(component.$('.pseudo-avatar').data('initials'), 'T', 'only one letter if there is no name');
-
-});
-
-
-test('can get avatars from commits', function() {
-
-
- var attr = {
- authorName: 'This is Author'
- };
-
- var user = Ember.Object.create(attr);
- var component = this.subject({user: user});
- this.append();
-
- equal(component.$('.real-avatar').attr('src'), 'https://www.gravatar.com/avatar/5e543256c480ac577d30f76f9120eb74?s=36&d=blank', 'get the right avatar url');
-
- equal(component.$('.pseudo-avatar').data('initials'), 'TI', 'gets right initials');
+ equal(component.$('.pseudo-avatar').data('initials'), 'HT', 'initials should be correct');
+ equal(component.$('.real-avatar').attr('src'), 'https://someurl.com/someimage.jpg', 'avatar should be right');
});