({
data,
status,
entity,
entityId,
}: {
data: Post;
status: ContentPreferenceStatus | null;
entityId: string;
entity: ContentPreferenceType;
})
| 556 | }; |
| 557 | |
| 558 | export const updatePostContentPreference = ({ |
| 559 | data, |
| 560 | status, |
| 561 | entity, |
| 562 | entityId, |
| 563 | }: { |
| 564 | data: Post; |
| 565 | status: ContentPreferenceStatus | null; |
| 566 | entityId: string; |
| 567 | entity: ContentPreferenceType; |
| 568 | }): Post => { |
| 569 | if (typeof status === 'undefined') { |
| 570 | return data; |
| 571 | } |
| 572 | |
| 573 | const newData = structuredClone(data); |
| 574 | |
| 575 | if (newData.author?.id === entityId) { |
| 576 | newData.author = updateAuthorContentPreference({ |
| 577 | data: newData.author, |
| 578 | status, |
| 579 | entity, |
| 580 | }); |
| 581 | } |
| 582 | |
| 583 | if (newData.scout?.id === entityId) { |
| 584 | newData.scout = updateAuthorContentPreference({ |
| 585 | data: newData.scout, |
| 586 | status, |
| 587 | entity, |
| 588 | }); |
| 589 | } |
| 590 | |
| 591 | return newData; |
| 592 | }; |
| 593 | |
| 594 | export const updateCommentContentPreference = ({ |
| 595 | data, |
no test coverage detected