diff --git a/app/components/contributor-list/template.hbs b/app/components/contributor-list/template.hbs
index f529eb9..ffe226c 100644
--- a/app/components/contributor-list/template.hbs
+++ b/app/components/contributor-list/template.hbs
@@ -1,6 +1,6 @@
{{#each contributors as |contributor|}}
-
+
{{contributor.name}}
@@ -10,7 +10,7 @@
₭S
|
-
+
- Inspect Ethereum transactions
diff --git a/app/helpers/is-current-user.js b/app/helpers/is-current-user.js
new file mode 100644
index 0000000..4d10707
--- /dev/null
+++ b/app/helpers/is-current-user.js
@@ -0,0 +1,16 @@
+import Helper from '@ember/component/helper';
+import { inject as service } from '@ember/service';
+import { alias } from '@ember/object/computed';
+import { isPresent } from '@ember/utils';
+
+export default Helper.extend({
+
+ kredits: service(),
+ currentUser: alias('kredits.currentUser'),
+
+ compute([contributor]) {
+ return isPresent(contributor) && isPresent(this.currentUser) &&
+ contributor.account === this.currentUser.account;
+ }
+
+});
diff --git a/app/models/contributor.js b/app/models/contributor.js
index 0bd38ea..3464aee 100644
--- a/app/models/contributor.js
+++ b/app/models/contributor.js
@@ -19,9 +19,6 @@ export default EmberObject.extend({
wiki_username: null,
ipfsData: '',
- // Deprecated
- isCurrentUser: false,
-
avatarURL: computed('github_uid', function() {
let github_uid = this.github_uid;
if (github_uid) {
diff --git a/tests/unit/helpers/is-current-user-test.js b/tests/unit/helpers/is-current-user-test.js
new file mode 100644
index 0000000..7f20042
--- /dev/null
+++ b/tests/unit/helpers/is-current-user-test.js
@@ -0,0 +1,38 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Helper | is-current-user', function (hooks) {
+ setupTest(hooks);
+
+ test('should be true if the given contributor is the current user', function (assert) {
+ const kredits = this.owner.lookup('service:kredits');
+ const currentUser = {
+ account: '0xD4264570B12dA659Ee4BBd41c3509B7b1F9c23AC'
+ }
+ kredits.set('currentUser', currentUser);
+
+ const contributor = {
+ account: '0xD4264570B12dA659Ee4BBd41c3509B7b1F9c23AC'
+ }
+
+ const isCurrentUser = this.owner.factoryFor('helper:is-current-user').create();
+
+ assert.ok(isCurrentUser.compute([contributor]));
+ });
+
+ test('should be false if the given contributor is not the current user', function (assert) {
+ const kredits = this.owner.lookup('service:kredits');
+ const currentUser = {
+ account: '0xD4264570B12dA659Ee4BBd41c3509B7b1F9c23AC'
+ }
+ kredits.set('currentUser', currentUser);
+
+ const contributor = {
+ account: '0xA4264570B12dA659Ee4BBd51c3509B7b1F9c23AC'
+ }
+
+ const isCurrentUser = this.owner.factoryFor('helper:is-current-user').create();
+
+ assert.notOk(isCurrentUser.compute([contributor]));
+ });
+});
|