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