1
0

Add showing and modifying user name (#306)

Make sure to use the user name field everywhere

Add showing and modifying user name

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/306
Co-Authored-By: konrad <konrad@kola-entertainments.de>
Co-Committed-By: konrad <konrad@kola-entertainments.de>
This commit is contained in:
konrad
2020-11-21 21:25:00 +00:00
parent c536707f3a
commit 3343b1c240
14 changed files with 92 additions and 10 deletions

View File

@ -12,6 +12,7 @@ export default class UserModel extends AbstractModel {
id: 0,
email: '',
username: '',
name: '',
created: null,
updated: null,
}
@ -20,4 +21,12 @@ export default class UserModel extends AbstractModel {
getAvatarUrl(size = 50) {
return `${window.API_URL}/${this.username}/avatar?size=${size}`
}
getDisplayName() {
if (this.name !== '') {
return this.name
}
return this.username
}
}

10
src/models/userName.js Normal file
View File

@ -0,0 +1,10 @@
import AbstractModel from './abstractModel'
export default class UserNameModel extends AbstractModel {
defaults() {
return {
name: '',
}
}
}