~cypheon/nextcloud-chores-app

c87f893e8b92e3c4efc8ff87a69b5285a3cb94d8 — Johann Rudloff 1 year, 8 months ago 8f52c0c
Show user's full name instead of username when possible
2 files changed, 14 insertions(+), 1 deletions(-)

M src/store.js
M src/views/Dashboard.vue
M src/store.js => src/store.js +10 -0
@@ 31,6 31,7 @@ export default {
    id: null,
    name: 'unknown',
    invites: [],
    membersNameMap: {},
  },
  invites: [],
  haveTeamInfo: false,


@@ 115,6 116,10 @@ export default {
      .then(async(response) => {
        if (response.status === 200) {
          this.team = await response.json();
          this.team.membersNameMap = {};
          this.team.members.forEach(m => {
            this.team.membersNameMap[m.member] = m.displayName;
          });
          this.haveTeamInfo = true;
        } else if (response.status === 204){
          this.team = null;


@@ 124,6 129,11 @@ export default {
      });
  },

  mapUserName: function(username) {
    const displayName = this.team.membersNameMap[username];
    return displayName || username;
  },

  choreById: function(choreId) {
    return this.chores.find(chore => chore.id === choreId);
  },

M src/views/Dashboard.vue => src/views/Dashboard.vue +4 -1
@@ 50,7 50,7 @@
          <NcUserBubble
            :size="36"
            :user="chore.assignee"
            :displayName="chore.assignee"
            :displayName="getUserDisplayName(chore.assignee)"
          />
        </td>
        <td class="cell-due">


@@ 176,6 176,9 @@ export default {
      this.store.submitWork(choreId);
      this.closeConfirmModal();
    },
    getUserDisplayName(username) {
      return this.store.mapUserName(username);
    },
    gotoLink(choreId) {
      this.$router.push(this.getLink(choreId));
    },