fix: fix notification m/p keyboard shortcuts (#907)

fixes #905
This commit is contained in:
Nolan Lawson 2019-01-19 23:52:39 -08:00 committed by GitHub
parent c1f6c1582d
commit 74ab056f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 4 deletions

View File

@ -203,12 +203,12 @@
goto(`/statuses/${originalStatusId}`)
},
openAuthorProfile () {
let { originalAccountId } = this.get()
goto(`/accounts/${originalAccountId}`)
let { accountForShortcut } = this.get()
goto(`/accounts/${accountForShortcut.id}`)
},
async mentionAuthor () {
let { originalAccount } = this.get()
await composeNewStatusMentioning(originalAccount)
let { accountForShortcut } = this.get()
await composeNewStatusMentioning(accountForShortcut)
}
},
computed: {
@ -222,6 +222,7 @@
accountId: ({ account }) => account.id,
originalAccount: ({ originalStatus }) => originalStatus.account,
originalAccountId: ({ originalAccount }) => originalAccount.id,
accountForShortcut: ({ originalAccount, notification }) => notification ? notification.account : originalAccount,
visibility: ({ originalStatus }) => originalStatus.visibility,
plainTextContent: ({ content }) => htmlToPlainText(content),
plainTextContentLength: ({ plainTextContent }) => measureText(plainTextContent),

View File

@ -56,3 +56,33 @@ test('Shortcut m toggles mention in a follow notification', async t => {
.click(closeDialogButton)
.expect(modalDialog.exists).notOk()
})
test('Shortcut p refers to booster in a boost notification', async t => {
let idx = 1 // "@admin boosted your status"
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.expect(getNthStatus(0).exists).ok({ timeout: 30000 })
.pressKey('j '.repeat(idx + 1))
.expect(getNthStatus(idx).hasClass('status-active')).ok()
.pressKey('p')
.expect(getUrl()).contains('/accounts/1')
})
test('Shortcut m refers to favoriter in a favorite notification', async t => {
let idx = 0 // "@admin favorited your status"
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.expect(getNthStatus(0).exists).ok({ timeout: 30000 })
.pressKey('j '.repeat(idx + 1))
.expect(getNthStatus(idx).hasClass('status-active')).ok()
.pressKey('m')
.expect(composeModalInput.value).eql('@admin ')
.click(closeDialogButton)
.expect(modalDialog.exists).notOk()
})