From 9923ff587b49486cf2e8ba5bdcb717db5d8dda84 Mon Sep 17 00:00:00 2001 From: Sol Fisher Romanoff Date: Wed, 22 Jun 2022 18:46:47 +0300 Subject: [PATCH 1/5] Add private note field to user profile --- src/components/user_profile/user_profile.js | 12 ++++++++++-- src/components/user_profile/user_profile.vue | 10 ++++++++++ src/i18n/en.json | 1 + src/modules/users.js | 8 ++++++++ src/services/api/api.service.js | 16 +++++++++++++++- 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index f779b823..3ab1adba 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -40,7 +40,8 @@ const UserProfile = { error: false, userId: null, tab: defaultTabKey, - footerRef: null + footerRef: null, + note: null } }, created () { @@ -110,9 +111,13 @@ const UserProfile = { const user = this.$store.getters.findUser(userNameOrId) if (user) { loadById(user.id) + this.note = user.relationship.note } else { this.$store.dispatch('fetchUser', userNameOrId) - .then(({ id }) => loadById(id)) + .then(({ id, relationship }) => { + this.note = relationship.note + return loadById(id) + }) .catch((reason) => { const errorMessage = get(reason, 'error.error') if (errorMessage === 'No user with such user_id') { // Known error @@ -145,6 +150,9 @@ const UserProfile = { if (target.tagName === 'A') { window.open(target.href, '_blank') } + }, + setNote () { + this.$store.dispatch('setNote', { id: this.userId, note: this.note }) } }, watch: { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index b1a20269..602c002c 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -40,6 +40,12 @@ +