From fbb256bc9baa495d299e02f13db8eb5e89713c01 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Tue, 27 Feb 2018 17:51:27 +0100
Subject: [PATCH] Fix #89: Always use username in sidebar

---
 CHANGELOG                                | 2 ++
 front/src/store/auth.js                  | 1 +
 front/test/unit/specs/store/auth.spec.js | 1 +
 3 files changed, 4 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 1b98df96e3..561c3f7e82 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,8 @@ Changelog
 0.6 (Unreleased)
 ----------------
 
+- Always use username in sidebar (#89)
+
 
 0.5.2 (2018-02-26)
 ------------------
diff --git a/front/src/store/auth.js b/front/src/store/auth.js
index 24dafcd726..7944cae083 100644
--- a/front/src/store/auth.js
+++ b/front/src/store/auth.js
@@ -89,6 +89,7 @@ export default {
         logger.default.info('Successfully fetched user profile')
         let data = response.data
         commit('profile', data)
+        commit('username', data.username)
         dispatch('favorites/fetch', null, {root: true})
         Object.keys(data.permissions).forEach(function (key) {
           // this makes it easier to check for permissions in templates
diff --git a/front/test/unit/specs/store/auth.spec.js b/front/test/unit/specs/store/auth.spec.js
index aa07f9f8bf..3271f5168f 100644
--- a/front/test/unit/specs/store/auth.spec.js
+++ b/front/test/unit/specs/store/auth.spec.js
@@ -176,6 +176,7 @@ describe('store/auth', () => {
         action: store.actions.fetchProfile,
         expectedMutations: [
           { type: 'profile', payload: profile },
+          { type: 'username', payload: profile.username },
           { type: 'permission', payload: {key: 'admin', status: true} }
         ],
         expectedActions: [
-- 
GitLab