remove unnecessary lodash/identity filters

This commit is contained in:
Nolan Lawson 2018-03-04 13:52:35 -08:00
parent 73861c4749
commit 2113a22511
4 changed files with 4 additions and 9 deletions

View File

@ -2,7 +2,6 @@ import { getIdsThatRebloggedThisStatus, getIdThatThisStatusReblogged, getNotific
import { store } from '../_store/store'
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
import { database } from '../_database/database'
import identity from 'lodash/identity'
function deleteStatusIdsFromStore (instanceName, idsToDelete) {
let idsToDeleteSet = new Set(idsToDelete)
@ -27,7 +26,7 @@ async function deleteStatusesAndNotifications (instanceName, statusIdsToDelete,
async function doDeleteStatus (instanceName, statusId) {
let reblogId = await getIdThatThisStatusReblogged(instanceName, statusId)
let rebloggedIds = await getIdsThatRebloggedThisStatus(reblogId || statusId)
let statusIdsToDelete = Array.from(new Set([statusId, reblogId].concat(rebloggedIds).filter(identity)))
let statusIdsToDelete = Array.from(new Set([statusId, reblogId].concat(rebloggedIds).filter(Boolean)))
let notificationIdsToDelete = new Set(await getNotificationIdsForStatuses(instanceName, statusIdsToDelete))
await Promise.all([
deleteStatusesAndNotifications(instanceName, statusIdsToDelete, notificationIdsToDelete)

View File

@ -1,4 +1,3 @@
import identity from 'lodash/identity'
import { database } from '../_database/database'
export async function getIdThatThisStatusReblogged (instanceName, statusId) {
@ -10,7 +9,7 @@ export async function getIdsThatTheseStatusesReblogged (instanceName, statusIds)
let reblogIds = await Promise.all(statusIds.map(async statusId => {
return getIdThatThisStatusReblogged(instanceName, statusId)
}))
return reblogIds.filter(identity)
return reblogIds.filter(Boolean)
}
export async function getIdsThatRebloggedThisStatus (instanceName, statusId) {

View File

@ -60,8 +60,6 @@
}
</style>
<script>
import identity from 'lodash/identity'
export default {
computed: {
computedClass: (pressable, pressed, big, className) => {
@ -71,7 +69,7 @@
pressed && 'pressed',
big && 'big-icon',
className
].filter(identity).join(' ')
].filter(Boolean).join(' ')
}
}
}

View File

@ -91,7 +91,6 @@
import StatusContent from './StatusContent.html'
import StatusSpoiler from './StatusSpoiler.html'
import { store } from '../../_store/store'
import identity from 'lodash/identity'
import { goto } from 'sapper/runtime.js'
import { registerClickDelegate, unregisterClickDelegate } from '../../_utils/delegate'
@ -129,7 +128,7 @@
originalStatus.visibility === 'direct' && 'status-direct',
timelineType !== 'search' && 'status-in-timeline',
isStatusInOwnThread && 'status-in-own-thread'
].filter(identity).join(' ')
].filter(Boolean).join(' ')
}
},
methods: {