summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-01-07 11:04:59 +0100
committerTim Zallmann <tzallmann@gitlab.com>2019-01-07 11:04:59 +0100
commit33cfeea1766602e4b390e841673b0516c593874a (patch)
treedef07ae58de2f8dfbfbe8bcc229d9ed9ea03755f
parent30038a40b08618380422ff3307061ca8fcbe0003 (diff)
downloadgitlab-ce-33cfeea1766602e4b390e841673b0516c593874a.tar.gz
Dryed code in commit_item by adding another computed prop
-rw-r--r--app/assets/javascripts/diffs/components/commit_item.vue17
1 files changed, 8 insertions, 9 deletions
diff --git a/app/assets/javascripts/diffs/components/commit_item.vue b/app/assets/javascripts/diffs/components/commit_item.vue
index 3e362ecf0b2..c02a8740a42 100644
--- a/app/assets/javascripts/diffs/components/commit_item.vue
+++ b/app/assets/javascripts/diffs/components/commit_item.vue
@@ -36,24 +36,23 @@ export default {
},
},
computed: {
+ author() {
+ return this.commit.author || {};
+ },
authorName() {
- return (this.commit.author && this.commit.author.name) || this.commit.author_name;
+ return this.author.name || this.commit.author_name;
},
authorClass() {
- return this.commit.author && this.commit.author.name ? 'js-user-link' : '';
+ return this.author.name ? 'js-user-link' : '';
},
authorId() {
- return this.commit.author && this.commit.author.name ? this.commit.author.id : '';
+ return this.author.id ? this.author.id : '';
},
authorUrl() {
- return (
- (this.commit.author && this.commit.author.web_url) || `mailto:${this.commit.author_email}`
- );
+ return this.author.web_url || `mailto:${this.commit.author_email}`;
},
authorAvatar() {
- return (
- (this.commit.author && this.commit.author.avatar_url) || this.commit.author_gravatar_url
- );
+ return this.author.avatar_url || this.commit.author_gravatar_url;
},
},
created() {