Merge branch 'fixAutocomplete' into 'develop'

Fixes broken autocomplete for users

See merge request pleroma/pleroma-fe!344
This commit is contained in:
kaniini 2018-09-13 19:30:28 +00:00
commit 7887e42fca

View File

@ -75,8 +75,11 @@ const PostStatusForm = {
candidates () { candidates () {
const firstchar = this.textAtCaret.charAt(0) const firstchar = this.textAtCaret.charAt(0)
if (firstchar === '@') { if (firstchar === '@') {
const matchedUsers = filter(this.users, (user) => (String(user.name + user.screen_name)).toUpperCase() const query = this.textAtCaret.slice(1).toUpperCase()
.startsWith(this.textAtCaret.slice(1).toUpperCase())) const matchedUsers = filter(this.users, (user) => {
return user.screen_name.toUpperCase().startsWith(query) ||
user.name && user.name.toUpperCase().startsWith(query)
})
if (matchedUsers.length <= 0) { if (matchedUsers.length <= 0) {
return false return false
} }