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

fixes #905
pull/913/head
Nolan Lawson 2019-01-19 23:52:39 -08:00 zatwierdzone przez GitHub
rodzic c1f6c1582d
commit 74ab056f18
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 35 dodań i 4 usunięć

Wyświetl plik

@ -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),

Wyświetl plik

@ -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()
})