fix: fix "Show more" button in Notifications timeline when filtered (#1255)

This commit is contained in:
Nolan Lawson 2019-05-29 18:48:59 -07:00 committed by GitHub
parent 45630c185f
commit fcf64c2169
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 3 deletions

View file

@ -130,8 +130,8 @@
itemIds: ({ $filteredTimelineItemSummaries }) => (
$filteredTimelineItemSummaries && $filteredTimelineItemSummaries.map(_ => _.id)
),
itemIdsToAdd: ({ $timelineItemSummariesToAdd }) => (
$timelineItemSummariesToAdd && $timelineItemSummariesToAdd.map(_ => _.id)
itemIdsToAdd: ({ $filteredTimelineItemSummariesToAdd }) => (
$filteredTimelineItemSummariesToAdd && $filteredTimelineItemSummariesToAdd.map(_ => _.id)
),
headerProps: ({ itemIdsToAdd }) => {
return {

View file

@ -143,6 +143,14 @@ export function timelineComputations (store) {
}
)
store.compute(
'filteredTimelineItemSummariesToAdd',
['timelineItemSummariesToAdd', 'timelineFilterFunction'],
(timelineItemSummariesToAdd, timelineFilterFunction) => {
return timelineItemSummariesToAdd && timelineItemSummariesToAdd.filter(timelineFilterFunction)
}
)
store.compute('timelineNotificationItemSummaries',
[`timelineData_timelineItemSummariesToAdd`, 'timelineFilterFunction', 'currentInstance'],
(root, timelineFilterFunction, currentInstance) => (

View file

@ -4,7 +4,11 @@ import {
instanceSettingNotificationReblogs,
notificationBadge,
instanceSettingNotificationFavs,
instanceSettingNotificationMentions, instanceSettingNotificationFollows
instanceSettingNotificationMentions,
instanceSettingNotificationFollows,
notificationsNavButton,
getUrl,
sleep, showMoreButton, scrollToBottom, scrollToTop
} from '../utils'
import { loginAsFoobar } from '../roles'
import { Selector as $ } from 'testcafe'
@ -91,3 +95,33 @@ test('Notification timeline filters correctly affect counts - follows', async t
.expect(notificationBadge.innerText).eql('1', { timeout })
await unfollowAs('ExternalLinks', 'foobar')
})
test('Notification timeline filters correctly show "show more" button', async t => {
await loginAsFoobar(t)
await t
.click(settingsNavButton)
.click($('a').withText('Instances'))
.click($('a').withText('localhost:3000'))
.click(instanceSettingNotificationMentions)
.expect(instanceSettingNotificationMentions.checked).notOk()
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.expect(getNthStatusContent(1).exists).ok()
await scrollToBottom()
await sleep(1000)
await postAs('admin', 'hey @foobar you should ignore this')
await sleep(1000)
await scrollToTop()
await sleep(1000)
await t
.expect(showMoreButton.innerText).contains('Show 0 more') // not shown
await scrollToBottom()
await sleep(1000)
await followAs('ExternalLinks', 'foobar')
await sleep(1000)
await scrollToTop()
await sleep(1000)
await t
.expect(showMoreButton.innerText).contains('Show 1 more', { timeout: 20000 })
await unfollowAs('ExternalLinks', 'foobar')
})