mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-09 18:26:48 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
22 lines
585 B
TypeScript
22 lines
585 B
TypeScript
import {ShipData} from 'common/api/profile-types'
|
|
import {User} from 'common/user'
|
|
|
|
export const hasShipped = (
|
|
currentUser: User | null | undefined,
|
|
target1Id: string | undefined,
|
|
target2Id: string | undefined,
|
|
ships: ShipData[],
|
|
) => {
|
|
return Boolean(
|
|
currentUser &&
|
|
target1Id &&
|
|
target2Id &&
|
|
ships.some(
|
|
({creator_id, target1_id, target2_id}) =>
|
|
creator_id === currentUser.id &&
|
|
((target1_id === target1Id && target2_id === target2Id) ||
|
|
(target1_id === target2Id && target2_id === target1Id)),
|
|
),
|
|
)
|
|
}
|