({
data,
status,
entity,
entityId,
}: {
data: PostComment;
status: ContentPreferenceStatus | null;
entityId: string;
entity: ContentPreferenceType;
})
| 553 | }; |
| 554 | |
| 555 | export const updateCommentContentPreference = ({ |
| 556 | data, |
| 557 | status, |
| 558 | entity, |
| 559 | entityId, |
| 560 | }: { |
| 561 | data: PostComment; |
| 562 | status: ContentPreferenceStatus | null; |
| 563 | entityId: string; |
| 564 | entity: ContentPreferenceType; |
| 565 | }): PostComment => { |
| 566 | if (typeof status === 'undefined') { |
| 567 | return data; |
| 568 | } |
| 569 | |
| 570 | const newData = structuredClone(data); |
| 571 | |
| 572 | if (newData.author?.id === entityId) { |
| 573 | newData.author = updateAuthorContentPreference({ |
| 574 | data: newData.author, |
| 575 | status, |
| 576 | entity, |
| 577 | }); |
| 578 | } |
| 579 | |
| 580 | return newData; |
| 581 | }; |
| 582 | |
| 583 | type QueryKeyReturnType = ReturnType<typeof generateQueryKey>; |
| 584 |
no test coverage detected