mirror of
https://github.com/tooot-app/app
synced 2025-04-17 19:57:33 +02:00
28 lines
664 B
TypeScript
28 lines
664 B
TypeScript
import { MutationVarsTimelineUpdateStatusProperty } from '@utils/queryHooks/timeline'
|
|
|
|
const updateConversation = ({
|
|
item,
|
|
payload
|
|
}: {
|
|
item: Mastodon.Conversation
|
|
payload: MutationVarsTimelineUpdateStatusProperty['payload']
|
|
}) => {
|
|
switch (payload.property) {
|
|
case 'poll':
|
|
if (item.last_status) {
|
|
item.last_status[payload.property] = payload.data
|
|
}
|
|
return item
|
|
default:
|
|
if (item.last_status) {
|
|
item.last_status[payload.property] =
|
|
typeof payload.currentValue === 'boolean'
|
|
? !payload.currentValue
|
|
: true
|
|
}
|
|
return item
|
|
}
|
|
}
|
|
|
|
export default updateConversation
|