Merge pull request #718 from h3poteto/696/fix

fixes #696 Check acct when parse account
This commit is contained in:
AkiraFukushima 2018-11-17 18:01:21 +09:00 committed by GitHub
commit 08af4bc609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -43,9 +43,11 @@ const AccountProfile = {
return client.get('/search', { q: parsedAccount.acct, resolve: true })
.then(res => {
if (res.data.accounts.length <= 0) throw new AccountNotFound('empty result')
const account = res.data.accounts.find(a => `@${a.username}` === parsedAccount.username)
if (!account) throw new AccountNotFound('not found')
return account
const account = res.data.accounts.find(a => `@${a.acct}` === parsedAccount.acct)
if (account) return account
const user = res.data.accounts.find(a => `@${a.username}@${rootState.TimelineSpace.account.domain}` === parsedAccount.acct)
if (!user) throw new AccountNotFound('not found')
return user
})
},
changeAccount ({ commit, dispatch }, account) {