From 451f11b74cb895b079c14316a4fd323f2eccff1c Mon Sep 17 00:00:00 2001 From: HCY123902 <54735123+HCY123902@users.noreply.github.com> Date: Mon, 15 Mar 2021 17:11:40 +0800 Subject: [PATCH] [#1446] Restore the name on authorship panel after reloading (#1458) The display name of the author is not shown after reloading the authorship panel. Let's enable the restoring of the name after reloading by adding an extra attribute to the state of `v_authorship`. --- frontend/src/static/js/v_authorship.js | 3 ++- frontend/src/tabs/authorship.pug | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/static/js/v_authorship.js b/frontend/src/static/js/v_authorship.js index fa7a578cae..af665245e8 100644 --- a/frontend/src/static/js/v_authorship.js +++ b/frontend/src/static/js/v_authorship.js @@ -19,6 +19,7 @@ function initialState() { filesSortType: 'lineOfCode', toReverseSortFiles: true, searchBarValue: '', + authorDisplayName: '', }; } @@ -155,7 +156,7 @@ window.vAuthorship = { } else { const author = repo.users.find((user) => user.name === this.info.author); if (author) { - this.info.name = author.displayName; + this.authorDisplayName = author.displayName; this.filesLinesObj = author.fileTypeContribution; } } diff --git a/frontend/src/tabs/authorship.pug b/frontend/src/tabs/authorship.pug index 97ac83a06c..f74594cf08 100644 --- a/frontend/src/tabs/authorship.pug +++ b/frontend/src/tabs/authorship.pug @@ -11,7 +11,7 @@ ) {{ info.repo }} .author(v-if="!info.isMergeGroup") span ↳   - span {{ info.name }} ({{ info.author }}) + span {{ authorDisplayName }} ({{ info.author }}) .period span ↳   span {{ info.minDate }} to {{ info.maxDate }}    ({{ selectedFiles.length }} files changed)