({
data,
status,
entity,
entityId,
}: {
data: PostComment;
status: ContentPreferenceStatus | null;
entityId: string;
entity: ContentPreferenceType;
})
| 591 | }; |
| 592 | |
| 593 | export const updateCommentContentPreference = ({ |
| 594 | data, |
| 595 | status, |
| 596 | entity, |
| 597 | entityId, |
| 598 | }: { |
| 599 | data: PostComment; |
| 600 | status: ContentPreferenceStatus | null; |
| 601 | entityId: string; |
| 602 | entity: ContentPreferenceType; |
| 603 | }): PostComment => { |
| 604 | if (typeof status === 'undefined') { |
| 605 | return data; |
| 606 | } |
| 607 | |
| 608 | const newData = structuredClone(data); |
| 609 | |
| 610 | if (newData.author?.id === entityId) { |
| 611 | newData.author = updateAuthorContentPreference({ |
| 612 | data: newData.author, |
| 613 | status, |
| 614 | entity, |
| 615 | }); |
| 616 | } |
| 617 | |
| 618 | return newData; |
| 619 | }; |
| 620 | |
| 621 | type QueryKeyReturnType = ReturnType<typeof generateQueryKey>; |
| 622 |
no test coverage detected