Add private note field to user profile
This commit is contained in:
parent
ca8689fc88
commit
9923ff587b
5 changed files with 44 additions and 3 deletions
|
@ -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: {
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<textarea
|
||||
v-model="note"
|
||||
class="note resize-height"
|
||||
:placeholder="$t('user_card.note')"
|
||||
@input="setNote"
|
||||
/>
|
||||
<tab-switcher
|
||||
:active-tab="tab"
|
||||
:render-only-focused="true"
|
||||
|
@ -202,6 +208,10 @@
|
|||
align-items: middle;
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.note {
|
||||
margin: 0.5em 0.75em;
|
||||
}
|
||||
}
|
||||
.user-profile-placeholder {
|
||||
.panel-body {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue