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 { store } from '../_store/store'
import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
import { database } from '../_database/database' import { database } from '../_database/database'
import identity from 'lodash/identity'
function deleteStatusIdsFromStore (instanceName, idsToDelete) { function deleteStatusIdsFromStore (instanceName, idsToDelete) {
let idsToDeleteSet = new Set(idsToDelete) let idsToDeleteSet = new Set(idsToDelete)
@ -27,7 +26,7 @@ async function deleteStatusesAndNotifications (instanceName, statusIdsToDelete,
async function doDeleteStatus (instanceName, statusId) { async function doDeleteStatus (instanceName, statusId) {
let reblogId = await getIdThatThisStatusReblogged(instanceName, statusId) let reblogId = await getIdThatThisStatusReblogged(instanceName, statusId)
let rebloggedIds = await getIdsThatRebloggedThisStatus(reblogId || 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)) let notificationIdsToDelete = new Set(await getNotificationIdsForStatuses(instanceName, statusIdsToDelete))
await Promise.all([ await Promise.all([
deleteStatusesAndNotifications(instanceName, statusIdsToDelete, notificationIdsToDelete) deleteStatusesAndNotifications(instanceName, statusIdsToDelete, notificationIdsToDelete)

View file

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

View file

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

View file

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