({
data,
status,
entity,
entityId,
}: {
data: PostComment;
status: ContentPreferenceStatus | null;
entityId: string;
entity: ContentPreferenceType;
})
| 575 | }; |
| 576 | |
| 577 | export const updateCommentContentPreference = ({ |
| 578 | data, |
| 579 | status, |
| 580 | entity, |
| 581 | entityId, |
| 582 | }: { |
| 583 | data: PostComment; |
| 584 | status: ContentPreferenceStatus | null; |
| 585 | entityId: string; |
| 586 | entity: ContentPreferenceType; |
| 587 | }): PostComment => { |
| 588 | if (typeof status === 'undefined') { |
| 589 | return data; |
| 590 | } |
| 591 | |
| 592 | const newData = structuredClone(data); |
| 593 | |
| 594 | if (newData.author?.id === entityId) { |
| 595 | newData.author = updateAuthorContentPreference({ |
| 596 | data: newData.author, |
| 597 | status, |
| 598 | entity, |
| 599 | }); |
| 600 | } |
| 601 | |
| 602 | return newData; |
| 603 | }; |
| 604 | |
| 605 | type QueryKeyReturnType = ReturnType<typeof generateQueryKey>; |
| 606 |
no test coverage detected