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