Commit 33cfeea1 authored by Tim Zallmann's avatar Tim Zallmann

Dryed code in commit_item by adding another computed prop

parent 30038a40
...@@ -36,24 +36,23 @@ export default { ...@@ -36,24 +36,23 @@ export default {
}, },
}, },
computed: { computed: {
author() {
return this.commit.author || {};
},
authorName() { authorName() {
return (this.commit.author && this.commit.author.name) || this.commit.author_name; return this.author.name || this.commit.author_name;
}, },
authorClass() { authorClass() {
return this.commit.author && this.commit.author.name ? 'js-user-link' : ''; return this.author.name ? 'js-user-link' : '';
}, },
authorId() { authorId() {
return this.commit.author && this.commit.author.name ? this.commit.author.id : ''; return this.author.id ? this.author.id : '';
}, },
authorUrl() { authorUrl() {
return ( return this.author.web_url || `mailto:${this.commit.author_email}`;
(this.commit.author && this.commit.author.web_url) || `mailto:${this.commit.author_email}`
);
}, },
authorAvatar() { authorAvatar() {
return ( return this.author.avatar_url || this.commit.author_gravatar_url;
(this.commit.author && this.commit.author.avatar_url) || this.commit.author_gravatar_url
);
}, },
}, },
created() { created() {
......
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