Show already added accounts in search

This commit is contained in:
Sol Fisher Romanoff 2022-06-16 09:41:07 +03:00
parent d1af4bdd51
commit dea803468f
Signed by untrusted user who does not match committer: nbsp
GPG key ID: 9D3F2B64F2341B62
2 changed files with 12 additions and 4 deletions

View file

@ -20,7 +20,6 @@ const ListNew = {
data () { data () {
return { return {
title: '', title: '',
suggestions: [],
userIds: [], userIds: [],
selectedUserIds: [], selectedUserIds: [],
loading: false, loading: false,
@ -40,11 +39,18 @@ const ListNew = {
users () { users () {
return this.userIds.map(userId => this.findUser(userId)) return this.userIds.map(userId => this.findUser(userId))
}, },
selectedUsers () {
const users = this.selectedUserIds.map(userId => this.findUser(userId))
if (users.includes(undefined)) {
return []
}
return users
},
availableUsers () { availableUsers () {
if (this.query.length !== 0) { if (this.query.length !== 0) {
return this.users return this.users
} else { } else {
return this.suggestions return this.selectedUsers
} }
}, },
...mapState({ ...mapState({

View file

@ -20,7 +20,6 @@ const ListNew = {
data () { data () {
return { return {
title: '', title: '',
suggestions: [],
userIds: [], userIds: [],
selectedUserIds: [], selectedUserIds: [],
loading: false, loading: false,
@ -31,11 +30,14 @@ const ListNew = {
users () { users () {
return this.userIds.map(userId => this.findUser(userId)) return this.userIds.map(userId => this.findUser(userId))
}, },
selectedUsers () {
return this.selectedUserIds.map(userId => this.findUser(userId))
},
availableUsers () { availableUsers () {
if (this.query.length !== 0) { if (this.query.length !== 0) {
return this.users return this.users
} else { } else {
return this.suggestions return this.selectedUsers
} }
}, },
...mapState({ ...mapState({